💾 Archived View for henn.es › cheatsheet › ssh.gmi captured on 2023-03-20 at 17:24:48. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

➡️ Next capture (2023-06-16)

-=-=-=-=-=-=-

hennes' SSH cheatsheet

Copy public key to authorized keys on remote server

cat id_rsa.pub | ssh USER@SERVER 'cat>> ~/.ssh/authorized_keys'

Port forwarding

ssh -NfL LOCAL_PORT:TARGET_IP_ON_REMOTE_HOST:TARGET_PORT_ON_REMOTE_HOST USER@SERVER

No -f to keep ssh process in foreground.

Example

Forward port to remote MySQL at example.com on local port 3307:

ssh -NfL 3307:127.0.0.1:3306 bob@example.com