Configuration file: ~/.ssh/config
# default identity
IdentityFile <PATH_TO_PRIVATE_KEY>
HashKnownHosts yes
IdentitiesOnly yes
Host <HOSTNAME>
IdentityFile <PATH_TO_PRIVATE_KEY>
Port <PORT>
User <USERNAME>
$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/foo -C 'me@example.com'
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/<USER>/.ssh/foo.
Your public key has been saved in /home/<USER>/.ssh/foo.pub.
The key fingerprint is:
77:b8:84:59:f8:74:21:66:bf:b2:fd:24:85:3c:cc:d2 me@example.com
The key's randomart image is:
+--[ RSA 4096]----+
| + . |
| + o . |
| . o o |
| * B o |
| S B E . |
| o B o |
| o o . |
| + |
| . |
+-----------------+
$
See also: https://help.github.com/articles/generating-ssh-keys/
# start the agent
$ eval $(ssh-agent -s)
# add keys
$ ssh-add
# list loaded keys
$ ssh-add -l
# LOCALPORT will be forwarded to <REMOTEHOST>:<REMOTEPORT> via <JUMPHOST>
$ ssh -fN -L <LOCALPORT>:<REMOTEHOST>:<REMOTEPORT> <USER>@<JUMPHOST>
$ man -f ssh-copy-id
ssh-copy-id (1) - install your public key in a remote machine's authorized_keys
$ ssh-copy-id <USER>@<HOST>
Configuration file: /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
Restart sshd
in
systemctl restart sshd.service
Source: ssh.md Created: 2022-08-16T14:02:42+03:00 Changed: 2022-11-13T11:03:27+02:00