Connect by ssh without password

How to configure server and client for SSH authentication without password.

  1. On client generate a new key

    You will be asked to enter passphrase and key file name. I entered empty passphrase and dmitry key name
  2. On client copy generated key to ~/.ssh folder
  3. On client use ssh-copy-id command for adding generated pub key to server’s authorized keys.
  4. On client edit ~/.ssh/config or create if not exists. Add following lines:
  5. On server, if you need to connect as root without password too, edit /etc/ssh/sshd_config, say yes to PermitRootLogin

    Then restart ssh

    Run visudo and edit line, starting from %sudo
  6. Now you can connect server without password

Leave a Reply

Your email address will not be published.