fduran

Linux Passwordless SSH

Apr 21st, 2011
1,095
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. # ssh without passwords, useful for unattended automatic scp/rsync-over-ssh copies etc
  2. # www.fduran.com
  3.  
  4. # Create public key without password in origin server:
  5. ssh-keygen -t rsa
  6.  
  7. # if ssh target port is not 22, add it (ex: -p 2020) in ssh-copy-id after 'ssh':
  8. # nano /usr/bin/ssh-copy-id
  9.  
  10. # Upload public key to remote target server:
  11. # using password (you need in the target server's sshd config file: ChallengeResponseAuthentication Yes )
  12. ssh-copy-id -i /home/user/.ssh/id_rsa.pub remote_ip
  13.  
  14. # or add public key of origin (do in origin server: ssh-keygen -y) in target's /home/user/.ssh/authorized_keys
  15.  
  16. # test:
  17. ssh -p 2020 remote_ip
Advertisement
Add Comment
Please, Sign In to add comment