ssh commands and password requests in a bash script -


i trying make script sync folder on ssh connection. want sync local folder folder on ssh , perform ssh login. these 2 commands need enter same password , it's little annoying trying make script put password temporary variable , pass variable 2 spots requested. have.

read -s -p "enter password: " mypassword && echo "$mypassword"  | rsync -vz -r `~/desktop/market_maker/market_maker xxx@xxx.edu:~/281_projects  && echo | "$mypassword" ssh xxx@xxx.edu` 

what ends doing gives me 3 password prompts , not work @ all. wrong script?

consider using sshpass store password specific login. once installed can run command:

sshpass -p 'password' ssh xxx@xxxx.edu 

to login server. think might functionality looking for. might consider setting rsync_password variable password in script.

if want avoid storing password in script can prompt using:

read -s rsync_password 

this store password duration of scripts execution.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -