login with ssh-key
linux: create and connect with SSH-key
[root@local-linux ~]# cd ~/.ssh
[root@local-linux .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:U9+M6TKXwZ6GAj1i7SCOFesWDCyQYC46JG4g9FtStN4 root@local-linux
The key's randomart image is:
+---[RSA 2048]----+
|++ .o |
|*.. . . |
|*ooo.o . |
|O. o=o.o . o = |
|oo .*.=ES * o |
|.. = + = o + + |
| . + o + B |
| . . = |
| |
+----[SHA256]-----+
[root@local-linux .ssh]# ls -laht
total 16K
drwx------. 2 root root 54 May 5 13:45 .
-rw-------. 1 root root 1.7K May 5 13:45 id_rsa
-rw-r--r--. 1 root root 402 May 5 13:45 id_rsa.pub
-rw-r--r--. 1 root root 3.0K May 5 13:44 known_hosts
dr-xr-x---. 21 root root 4.0K May 3 07:06 ..
[root@local-linux .ssh]# ssh-copy-id some.user@78.141.215.162
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
some.user@78.141.215.162's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'some.user@78.141.215.162'"
and check to make sure that only the key(s) you wanted were added.
[root@local-linux .ssh]# ssh some.user@78.141.215.162
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Wed May 5 10:50:02 2021 from 85.23.146.80
[some.user@remote-linux ~]$ exit
logout
Connection to 78.141.215.162 closed.