Issue
I have 2 solaris servers. I want to write a shell script which will copy a file from one server to the other.
scp /tmp/test/a.war [email protected]:/tmp/
The above command when executed in PUTTY will ask me to enter a password for the destination. This is fine when using PUTTY.
How can iI enter the password while running the scp
command through shell script?
Thanks in advance
Solution
You have to setup SSH private/public key.
Once generated place the public key line entry on the target server's and user's ~/.ssh/authorized_keys file.
Make sure the file on the source machine (for the user which will run the scp/ssh command) will have file permission (400) recommended.
https://unix.stackexchange.com/questions/182483/scp-without-password-prompt-using-different-username or
http://docs.oracle.com/cd/E19253-01/816-4557/sshuser-33/index.html or similar online help can help you.
Answered By - AKS Answer Checked By - Clifford M. (WPSolving Volunteer)