ssh-keygen
NetworkFundamentals In real LinuxGenerate SSH key pairs
Name: ssh-keygen = SSH key generator
This command needs a real Linux system; you can practise it in real Linux mode.
Description
ssh-keygen creates SSH key pairs. The private key (e.g. ~/.ssh/id_ed25519) stays secret; the public key (ending .pub) goes into a server's ~/.ssh/authorized_keys for password-less logins.
Syntax
ssh-keygen [OPTION]...Common options
| -t TYPE | Key type; ed25519 is recommended |
| -b BITS | Key size (4096 is common for RSA; not needed for ed25519) |
| -C COMMENT | Comment, usually an email |
| -f FILE | Output file |
| -N PASSPHRASE | The passphrase for the new key (-N "" for none) |
| -p | Change the passphrase of an existing key |
| -l | Show the key’s fingerprint |
| -y | Print the public key of a private key |
| -R HOST | Remove a host from known_hosts (when its key changed) |
Examples
$ ssh-keygen -t ed25519 -C "[email protected]"
Create a new key
Explain$ ssh-copy-id backup01
Install your public key on backup01: no password next time
Explain