On the client:
socrat@socrat-laptop ~/.ssh $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/socrat/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/socrat/.ssh/id_rsa.
Your public key has been saved in /home/socrat/.ssh/id_rsa.pub.
The key fingerprint is:
The key’s randomart image is:
+–[ RSA 2048]—-+
| + o . +|
| S + oo|
| o . ….|
| . o..*o|
| . ..o@|
socrat@socrat-laptop ~/.ssh $ ssh-copy-id socrat@ubuntu-server
The authenticity of host ‘ubuntu-server (192.168.0.1)’ can’t be established.
ECDSA key fingerprint is a4:d7:2f:17:b9:35:ec:cf:bf:db:ff:39:32:08:8b:8b.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 2 key(s) remain to be installed — if you are prompted now it is to install the new keys
Number of key(s) added: 2
Now try logging into the machine, with: “ssh ‘socrat@ubuntu-server'”
and check to make sure that only the key(s) you wanted were added.
socrat@socrat-laptop ~/.ssh $ ssh socrat@ubuntu-server
Welcome to Ubuntu
That’s it, Have Fun!