Code: Alles auswählen
~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Ng60JoqFM9jLIgbggzZTGFfgkjnhuohzguFrtfv698hnHuhnjlk benny@SuckboxM
The key's randomart image is:
+---[RSA 2048]----+
| + .. . . . |
| E. . o.|
| . . * + +|
|.o . . + * ..|
|* = o + EE. . = |
| O -- + . + |
|. + .. = . . . |
| . = = . |
| o=.o . |
+----[SHA256]-----+
Code: Alles auswählen
~$ ssh-copy-id root@192.168.0.1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/user/.ssh/id_rsa.pub"
/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: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.0.1's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.0.1'"
and check to make sure that only the key(s) you wanted were added.
Code: Alles auswählen
~$ ssh root@192.168.0.1
Bei einem OpenWRT (z. B. Router) muss man den öffentlichen Schlüssel noch in der Weboberfläche hochladen.
Die Datei id_rsa.pub (zu finden unter /home/user/.ssh/ ) muss in einem Editor geöffnet werden und der Inhalt dann in die Eingabebox für die ssh-keys kopiert werden. (Unter System --> Administration)