Cover Image

Rask huskelapp: Generere SSH-keys og kopiere dem til målsystemer

 Thu 2022-04-14    SysAdm
user:~% ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/USERNAME/.ssh/id_rsa): <Enter>
Enter passphrase (empty for no passphrase): <Enter>
Enter same passphrase again: <Enter>
Your identification has been saved in /home/USERNAME/.ssh/id_rsa
Your public key has been saved in /home/USERNAME/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:h6ofUC+gnhq8wVugzbgtAZaJkulhm3d74LWCxjxaWcI USERNAME@HOST
The key's randomart image is:
+---[RSA 4096]----+
|                 |
|       . .       |
|  .   . o .      |
| * . . . o       |
|*oE + o S        |
|*.=%.+ +         |
|+OXo+o+ o        |
|oO+ o+.*         |
|= ....+.o        |
+----[SHA256]-----+
̃
user:~% ssh-copy-id user@remote-host
/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
user@remote-host's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh 'user@remote-host'"
and check to make sure that only the key(s) you wanted were added.

user:~% ssh user@remote-host
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-100-generic x86_64)
(...)
user@remote-host:~$ _