How To Set Up SSH Keys on Debian/Ubuntu
ssh-keygen -t rsa
You will be prompted for a location to save the keys, and a passphrase for the keys. This passphrase will protect your private key while it’s stored on the hard drive and be required to use the keys every time you need to login to a key-based system:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/b/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/b/.ssh/id_rsa.
Your public key has been saved in /home/b/.ssh/id_rsa.pub.
cp id_rsa.pub authorized_keys
chmod 700 ~/.ssh
chmod 600 authorized_keys
Then edit your /etc/ssh/sshd_config to:
AuthorizedKeysFile /etc/ssh/%u/authorized_keys
Finally, restart ssh with:
service ssh restart
On the host computer, ensure that the /etc/ssh/sshd_config contains the following lines, and that they are uncommented;
PubkeyAuthentication yes
RSAAuthentication yes
if disable the PasswordAuthentication,change
PasswordAuthentication yes
to
PasswordAuthentication no
How To Set Up SSH Keys on Debian/Ubuntu
No comments:
Post a Comment