0

I'm running a script that copies files from another server.... It's prompting for a password of that server... Every time I need to enter the password manually... So s there any way to automate this?

scp root@ip:file_location destination

Note for security purposes I was not supposed to use password less login, or ssh

Praveen
  • 43
  • 1
  • 6

1 Answers1

0

You can try to use sshpass which takes the password from an evironment variable named "SSHPASS" if switch -e is provided. So you can use something like:

export SSHPASS=<yourpw>
sshpass -e scp <sourcefile> user@ip:<targetpath/filename>

But of course it still uses ssh underneath, like Sergiy explained in the comment.

clehe
  • 16
  • 1