| Basic SSH | Description |
|---|---|
| ssh user@host | Connect to remote host |
| ssh -p 2222 | Specify custom port |
| ssh -v | Verbose connection output |
| ssh -X | Enable X11 forwarding |
| Key Management | Description |
|---|---|
| ssh-keygen | Generate SSH key pair |
| ssh-copy-id | Copy public key to host |
| ~/.ssh/config | Client config file |
| chmod 600 ~/.ssh/id_rsa | Secure private key |
| File Transfer | Description |
|---|---|
| scp file user@host:/path | Copy file to remote |
| scp user@host:/path file | Copy file from remote |
| rsync -avz | Sync files over SSH |
| sftp user@host | Secure FTP session |
| Tunneling | Description |
|---|---|
| ssh -L 8080:localhost:80 | Local port forwarding |
| ssh -R 2222:localhost:22 | Remote port forwarding |
| ssh -D 1080 | Dynamic SOCKS proxy |
| autossh | Auto-reconnect SSH tunnel |
| Server Config | Description |
|---|---|
| /etc/ssh/sshd_config | Server config file |
| systemctl restart ssh | Restart SSH service |
| PermitRootLogin no | Disable root login |
| PasswordAuthentication no | Enforce key-only login |