This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
geek:ssh [2019/09/27 14:06] neil created |
geek:ssh [2025/04/22 19:52] (current) admin |
||
|---|---|---|---|
| Line 19: | Line 19: | ||
| <code bash>ssh localhost -p 12345</code> | <code bash>ssh localhost -p 12345</code> | ||
| + | |||
| + | ===== SSH port forwarding ==== | ||
| + | Connect into a host, access mysql (3306) on an internal server (192.168.1.15) and connect it to port 30000 on your local machine. You can then access mysql directly with ''mysql -h localhost -p 30000'', for example. (-N to not execute a command) | ||
| + | <code bash> | ||
| + | ssh -N -L 30000:192.168.1.15:3306 user@server | ||
| + | </code> | ||
| ===== SSH key login ===== | ===== SSH key login ===== | ||
| Line 29: | Line 35: | ||
| <code bash>ssh user@server "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"</code> | <code bash>ssh user@server "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"</code> | ||
| + | ===== SSH Fingerprint ===== | ||
| + | Some services want a server's SSH fingerprint, you can generate in the format they usually want with this command: | ||
| + | <code bash> | ||
| + | cut -d ' ' -f 2 < /etc/ssh/ssh_host_rsa_key.pub | base64 -d | openssl dgst -c -sha1 | ||
| + | </code> | ||