-1

I need to transfer files from machine 'A' to machine 'B' and I'm executing the command from machine from 'C'.

Run Command : 

$sshpass -p 'password_for_a' ssh -A -t a@x.x.x.x rsync -avz /home/test/* b@x.x.x.x:/home/test/

This prompts the "Password" for machine "B" which i do not want to type manually. I cannot install "sshpass" on machine "A" because i don't have authorization to install lib/packages.

Is there anyway to include the password using rsync/scp for the above command ?

I tried passing password using 'scp' 'PreferredAuthentications' too.

$sshpass -p 'password_for_a' ssh -A -t a@x.x.x.x scp -o PreferredAuthentications="password_for_b" /home/test/* b@x.x.x.x:/home/test/ 

I'm getting ,

Permission denied (publickey,password).
lost connection

If i am wrong anywhere , Please correct me ?

Arun
  • 1,160
  • 3
  • 17
  • 33
  • 2
    The server supports public key authentication. Your best bet is to set that up and not pass passwords around. – l0b0 Jul 09 '17 at 08:40
  • Since i don't wanna mess up during public key authentication on config files , I wanted to make it smooth using the above way. Need to look if there is no option then ! Thanks anyway – Arun Jul 09 '17 at 09:06
  • There is a password file option with rsync but only when an rsync daemon is running on the remote server. – Raman Sailopal Jul 09 '17 at 09:54
  • Do you have `expect` installed? What does `which expect` say? – hidefromkgb Jul 09 '17 at 10:04
  • 1
    Do not write passwords in command line parameters. Command line parameters are public: `ps -ef`. – ceving Jul 10 '17 at 12:40

2 Answers2

1

There is nothing like PreferredAuthentications="password_for_b". The authentication method is called password. If you specify something invalid, it obviously fails. Set up public key authentication.

Jakuje
  • 24,773
  • 12
  • 69
  • 75
1

Thanks All , I generated ssh-keygen and copied key files to (*.pub) respective machines. Now i can do password less authentications. Got clarify post discussions.

Arun
  • 1,160
  • 3
  • 17
  • 33