Yesterday, I was working on some shell script piece for my project and I came across a situation where I have to copy some files from one server to another using ‘scp’ command and also some time have to execute some command on other server. One requirement was we don’t need to pass the password of functional id inside the script.
User should be able to login to other server without password using command “ssh -l username remotehost”.
For this I used SSH public key based authentication as below:-