Install ssh on the server:
apt-get install openssh-server
Generate a key pair (files id_rsa
and id_rsa.pub
) with a passphrase:
ssh-keygen
Edit the ssh configuration file:
vi /etc/ssh/sshd_config
In the file, make the following settings:
PasswordAuthentication no PermitRootLogin without-password RSAAuthentication yes PubkeyAuthentication yes
Add the public key as an authorized key for root
that can be used for login:
cat id_rsa.pub >> /root/.ssh/authorized_keys
That’s all for the server!
Now for the client. Copy the key pair into the folder ~/.ssh
. Now you should be able to connect with:
ssh -i ~/.ssh/id_rsa root@server