PSCP.PSSH command to copy files to remote server
How can I use pscp.pssh command to copy files to the remote server with the help of private key and not password.
This is the command I am using and I get password prompt. Please help
pscp.pssh -h hosts.txt -l vipin -x "-o StrictHostKeyChecking=no -i vipin_rsa.pem" -Av example.txt /tmp/
Some of the answers to the questions:
- The remote servers have public key.
- I get a password prompt while running the command.
- Private key resides in the same directory from where I am executing the command.
Prompt for a password and pass it to ssh. The password may be used for either to unlock a key or for password authentication. The password is transferred in a fairly secure manner (e.g., it will not show up in argument lists). However, be aware that a root user on your system could potentially intercept the password.
In other words,
pscp.pssh is asking for a password because you have told it to ask, by using the option
-A. If you don’t want that, remove the option, i.e. change the
-Av to just
-v in your command line.
If you still get a password prompt after that, you will have to figure out which of the (potentially) many hosts in your
hosts.txt file is rejecting the key authentication, and read the logs of that remote server to find out why its
sshd is rejecting your key.
A common reason is incorrect permissions to the authorized keys file on the remote server: if other users (other than root) could write their keys to the file,
sshd will assume the authorized keys file may have been tampered with, and ignores it entirely. If this is the case, the log message from
sshd in the server’s log will describe exactly which file or directory has the incorrect permissions – but won’t pass that information to an as-yet-unauthenticated (= not yet proven to be legitimate!) client for security reasons.