Printer FriendlyEmail Article Link

UNIX: How do you configure scp on a server to not prompt for a password when transferring a file?

Environment/Versions
  • HP All Versions
Answer

client-machine% ssh-keygen -t rsa
client-machine% scp ~/.ssh/id_rsa.pub user@target-machine:~/.ssh/authorized_keys2

  • Note that if you want to access target-machine from two or more "clients", you can not copy the id_rsa.pub to authorized_keys2 directly.
  • You will need to open authorized_keys2 and paste the id_rsa.pub from each client machine on it (or use the line below to append the content)

client-machine% cat ~/.ssh/id_rsa.pub | ssh user@target-machine \
'cat >> .ssh/authorized_keys'

  • Now you can use ssh/scp without user/password information:

client-machine% ssh user@target-machine
client-machine% scp file user@target-machine:~/file


Product : UNIX