SSH (OpenSSH) 10 cheatsheet
SSH (OpenSSH) 10: Connecting
8 common SSH (OpenSSH) 10 tasks.
Connect on another port with a specific key
Use a non-default port and an identity file.
ssh -p 2222 -i ~/.ssh/id_ed25519 [email protected]
Run a command on the server
Run one command and print its output locally.
ssh [email protected] 'uptime && df -h /'
Run an interactive program remotely
Allocate a terminal so programs like top and sudo work.
ssh -t [email protected] 'sudo systemctl status nginx'
Debug a failing connection
Print detailed logs of the connection and authentication attempts. Add more v's for more detail.
ssh -vvv [email protected]
Connect through a bastion host
Reach a private server by hopping through a jump host.
Copy a file over SSH
Copy a local file to a server.
scp -P 2222 file.txt [email protected]:/home/user/
Copy with resumable transfers
Use rsync over SSH to resume interrupted transfers.
rsync -avz --partial --progress -e ssh ./folder/ [email protected]:/srv/folder/