- Edit
etc/ssh/sshd_config:
-
Uncomment
PubkeyAuthentication yes -
Setup auth key values path with
AuthorizedKeysFile .ssh/authorized_keys -
Set next configs to disable default password authentification (if you need it)
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no- Create .ssh folder:
mkdir -p ~/.ssh - Applay access ruels to the folder:
chmod 700 .ssh - Reload ssh server to apply changes
sudo /etc/init.d/ssh force-reload
- Gereate and add to ssh-agent SSH key
- Copy public key value to authorized_keys:
cat ~/.ssh/id_rsa.pub | ssh <username>@<remote_machine> 'cat >> ~/.ssh/authorized_keys'