Passwordless SSH on Ubuntu Linux
- Install openssh server
sudo apt-get install openssh-server
- Remove previous .ssh directory (from home directory)
rm -r .ssh/
- Now Execute the below command. Leave all the field empty when asked.
ssh-keygen -t rsa
- Execute the following commands after that
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys sudo chmod go-w ~/ chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys exec ssh-agent bash ssh-add
You can test on your machine.
ssh-copy-id localhost ssh localhost
When you ssh localhost, it will not ask you password again.