SSH password less login
In this blog I am going to explain how to login to a linux machine through ssh with out password.
SSH password less login is one of the good feature of secure shell (ssh) .If you are logging in to a remote machine many time every day via secure shell (ssh) then ssh password less login will save your time of entering password.
Consider that there are two machines with IP address 192.168.1.8 and 192.168.1.9. I am using 192.168.1.8 machine with username rajkumar and I want to take 192.168.1.9 machine’s admin user remotely via ssh without password.
Login to the remote machine 192.168.1.9 as admin user
Yes you can see from the above image that it is asking for password while login.
Ok!! Let’s learn how to login to remote machine without password.
Step 1: Generate ssh-keygen from the specific user(rajkumar) login
su – rajkumar
If you give ssh-keygen it will ask you in which location rsa key should save give enter for that.
Then it will prompt for pass-phrase password simply give enter for that.
Step 2: Go to the user’s home directory and copy the id_rsa.pub to authorized_keys.
cp id_rsa.pub authorized_keys
Step 3: Check .ssh folder is available on adminuser’s home directory
Login in to remote machine as firstname.lastname@example.org
Check .ssh folder is already available or not.If .ssh folder is not already available create it with ssh-keygen command.
If .ssh folder is already available continue with Step 4
Step 4: Copy the authorized_keys file to /home/adminuser/.ssh/ via scp
scp authorized_keys email@example.com:/home/adminuser/.ssh/
Step 5: Login in to the remote machine with out password
If still not able to login with out password. login in to 192.168.1.9 machine as adminuser and follow the below steps
$ chmod go-w $HOME $HOME/.ssh
$ chmod 600 $HOME/.ssh/authorized_keys
$ chown `whoami` $HOME/.ssh/authorized_keys
If still not able to login with out password. login in to 192.168.1.9 machine as root user and follow the below steps
Change StrictModes from “yes” to “no” and save the file. Restart the ssh service it will definitely work but changing StrictModes from “yes” to “no” is not recommended.