-
install ssh server
sudo apt-get install openssh-server
-
generate a key pair
ssh-keygen -t rsa
if your have entered file in which to save the key, for example,
flir
then two file namedflir
andflir.pub
will be generated at the current folder, represent private key and public key respectively. If not, rsa and rsa.pub is the name by default, and they can be found at the folder~/.ssh/
-
the private key and public key should be palced at
$HOME/.ssh/
mv flir ~/.ssh/ mv flir.pub ~/.ssh/
-
uplode the public key
flir.pub
to the serverssh-copy-id -i ~/.ssh/flir.pub <username>@<ipaddress>
-
now try logging into the server with
ssh <username>@<ipaddress>
- The client generate a private key and public key pair
- The private key should be placed at the folder
~/.ssh/
of client - The content of public key should be concatenated at the file
~/.ssh/authorized_keys
of server - The
~/.ssh
folder should be in modedrwx------
(700) in order to forbidden to other users - Once configured the ssh login with key, it's better to refuse access by password at the server side by setting
PasswordAuthentication no
in/etc/ssh/sshd_config
of the server
Reference