- At host
- First, edit
/etc/ssh/sshd_config
to turn on password login.sudo vim /etc/ssh/sshd_config
- Find and comment these two lines
PasswordAuthentication no PubkeyAuthentication yes
- Restart ssh.
sudo systemctl restart ssh
- First, edit
- At client
- Generate your private/public key pair.
ssh-keygen
- Copy client public key from client to host.
ssh-copy-id <user>@<host IP>
- Check if it works.
ssh <user>@<host IP>
- Remove passphrase [optional]
ssh-keygen -p
- Generate your private/public key pair.
- At host
- Edit
/etc/ssh/sshd_config
again.sudo vim /etc/ssh/sshd_config
- Find and uncomment these two lines
PasswordAuthentication no PubkeyAuthentication yes
- Restart ssh.
sudo systemctl restart ssh
- Edit