This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cheatsheet:ssh [2023/02/16 20:54] – kamaradski | cheatsheet:ssh [2023/02/21 12:24] (current) – kamaradski | ||
|---|---|---|---|
| Line 31: | Line 31: | ||
| $ ssh username@hostname " | $ ssh username@hostname " | ||
| </ | </ | ||
| + | |||
| + | ===== keys and certificates ===== | ||
| + | |||
| + | ==== create id_rsa ssh key ==== | ||
| + | <code bash> | ||
| + | $ ssh-keygen -t rsa | ||
| + | or | ||
| + | $ ssh-keygen -t rsa -b 4096 -C "< | ||
| + | </ | ||
| + | |||
| + | ==== copy local public key to remote " | ||
| + | <code bash> | ||
| + | $ ssh-copy-id -i ~/ | ||
| + | </ | ||
| + | |||
| + | ==== remove a specific host from the known_hosts file ==== | ||
| + | <code bash> | ||
| + | $ ssh-keygen -f "/ | ||
| + | |||
| + | # Host 10.0.0.10 found: line 39 | ||
| + | # Host 10.0.0.10 found: line 40 | ||
| + | / | ||
| + | Original contents retained as / | ||
| + | </ | ||
| + | |||
| ===== create " | ===== create " | ||
| Line 162: | Line 187: | ||
| In this example, you're connecting to the " | In this example, you're connecting to the " | ||
| + | |||
| + | |||
| + | ===== SSHd settings ===== | ||
| + | |||
| + | Related file: / | ||
| + | |||
| + | ==== disable the use of passwords to login ==== | ||
| + | Note: make sure you have a working key-based login in place before doing this (or local access via a real keyboard/ | ||
| + | |||
| + | < | ||
| + | ChallengeResponseAuthentication no | ||
| + | PasswordAuthentication no | ||
| + | UsePAM no | ||
| + | </ | ||
| + | |||
| + | ==== disable the root account from logging in ==== | ||
| + | |||
| + | < | ||
| + | PermitRootLogin no | ||
| + | # | ||
| + | </ | ||
| + | |||