Keyless SSH LOGIN

This explains how to login to another system without a password
  • remote machine - the server/laptop/desktop you want to login to with your ssh key
  • client machine - machine being used by you

Note:
make sure you use the same username on both machines
replace <username> with your actual username
replace <remote-machine> with your actual machine name or ipaddres

Generate SSH Keys
 If you already have a public key escape this step

ssh-keygen -t rsa

Keep passphrase empty

Create .ssh directory on remote machine - skip this if .ssh is already present
Verify if .ssh directory exists

ssh <username>@<remote-machine> ls -al 

Create .ssh dir


ssh <username>@<remote-machine> mkdir -p .ssh

Copy public key to remote machine


cat .ssh/id_rsa.pub | ssh <username>@<remote-machine> 'cat >> .ssh/authorized_keys'

Change permissions


ssh <username>@<remote-machine> chmod 700 .ssh
ssh <username>@<remote-machine> chmod 600 .ssh/authorized_keys

Verify if you can successfully login without password

ssh <remote-machine> ls -al

Now you are in business. Enjoy!!!

Comments

Popular Posts