-2

I have a shell script which contains following command to copy test.dat file from remote server to my current directory :

scp remote_user_id@remote_server_name:<filepath>/test.dat .

upon executing the script , It asks for password which I have to enter manually. I do not have access to install or use sshpass or expect or even setting up ssh. How can I pass this password in the shell script ?

Jakuje
  • 24,773
  • 12
  • 69
  • 75
user3436156
  • 103
  • 1
  • 2
  • 11
  • 1
    Possible duplicate of [How to pass password to scp?](http://stackoverflow.com/questions/50096/how-to-pass-password-to-scp) – kadamb Nov 01 '16 at 11:50

1 Answers1

1

Use public key authentication

 -i identity_file

Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1).

You could also use rsync. rsync has options like --password-file

gj13
  • 1,314
  • 9
  • 23