How to configure server and client for SSH authentication without password.
- On client generate a new key
1ssh-keygen -t rsa -b 2048 -v
You will be asked to enter passphrase and key file name. I entered empty passphrase and dmitry key name - On client copy generated key to ~/.ssh folder
- On client use ssh-copy-id command for adding generated pub key to server’s authorized keys.
1$ ssh-copy-id -i dmitry.pub user1@myserver1 - On client edit
~/.ssh/config or create if not exists. Add following lines:
123Host *StrictHostKeyChecking noUserKnownHostsFile=/dev/null - On server, if you need to connect as root without password too, edit /etc/ssh/sshd_config, say yes to PermitRootLogin
12#PermitRootLogin without-passwordPermitRootLogin yes
Then restart ssh
1service ssh restart
Run visudo and edit line, starting from %sudo
1%sudo ALL=(ALL:ALL) NOPASSWD:ALL - Now you can connect server without password
1ssh user1@myserver1