Friday, January 2, 2015

Linux - SSH login without password

  1. Assuming you want to setup password less ssh login for user "user-1" from host "machine-1" to user "root" on host "machine-2"
  2. Login into "machine-1" as "user-1"
  3. Check if there exists a file "/home/user-1/.ssh/id_rsa.pub" (Note dot . before ssh). If this file exists then go to step 5
  4. Run this command with all default values 
    • ssh-keygen -t rsa
  5. Run this command to copy "/home/user-1/.ssh/id_rsa.pub" file to remote host 
    • ssh-copy-id -i root@machine-2
  6. Try login into remote machine and verify that it does not ask for any password
    • ssh root@machine-2
  7. You can also directly run commands on remote machine
    • ssh root@machine-2 hostname
References :-
  1. http://www.linuxproblem.org/art_9.html
  2. http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

No comments :

Post a Comment