ssh

SSH Cheatsheet #

SSH (Secure Shell) is a protocol for securely accessing and managing network devices and servers.

Basic Commands #

Command/OptionExampleDescription
sshssh user@hostConnect to a remote host as a specified user
ssh -pssh -p 2222 user@hostSpecify a port to connect to on the remote host (-p for port)
ssh -issh -i ~/.ssh/id_rsa user@hostSpecify a private key file for authentication (-i for identity file)
ssh -Xssh -X user@hostEnable X11 forwarding for graphical applications (-X for X11 forwarding)
ssh -Assh -A user@hostEnable agent forwarding to use local keys remotely (-A for agent forwarding)
ssh-copy-idssh-copy-id user@hostInstall your public key on a remote server for passwordless login
ssh-keygenssh-keygen -t rsaGenerate a new SSH key pair (-t for type, e.g., rsa, dsa)
ssh-keyscanssh-keyscan example.comRetrieve the SSH public key from a server (ssh-keyscan command)

Advanced Commands #

Command/OptionExampleDescription
scpscp file.txt user@host:/path/Copy files between hosts securely (scp for secure copy)
scp -rscp -r dir/ user@host:/path/Recursively copy directories (-r for recursive)
sftpsftp user@hostStart an interactive SFTP session for file transfers (sftp command)
sshfssshfs user@host:/remote/path /local/mountpointMount a remote filesystem over SSH (sshfs command)
ssh -ossh -o ConnectTimeout=10 user@hostSpecify SSH options, like connection timeout (-o for options)
ssh -Cssh -C user@hostEnable compression to speed up transfers (-C for compression)
ssh -Tssh -T user@hostDisable pseudo-tty allocation, useful for command execution (-T for no TTY)
ssh -qssh -q user@hostSuppress warnings and error messages (-q for quiet mode)

This cheatsheet covers the essential ssh commands and options for secure shell access and file transfer.

ssh

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.