OpenSSH

Secure Shell Reference

Basic SSHDescription
ssh user@hostConnect to remote host
ssh -p 2222Specify custom port
ssh -vVerbose connection output
ssh -XEnable X11 forwarding
Key ManagementDescription
ssh-keygenGenerate SSH key pair
ssh-copy-idCopy public key to host
~/.ssh/configClient config file
chmod 600 ~/.ssh/id_rsaSecure private key
File TransferDescription
scp file user@host:/pathCopy file to remote
scp user@host:/path fileCopy file from remote
rsync -avzSync files over SSH
sftp user@hostSecure FTP session
TunnelingDescription
ssh -L 8080:localhost:80Local port forwarding
ssh -R 2222:localhost:22Remote port forwarding
ssh -D 1080Dynamic SOCKS proxy
autosshAuto-reconnect SSH tunnel
Server ConfigDescription
/etc/ssh/sshd_configServer config file
systemctl restart sshRestart SSH service
PermitRootLogin noDisable root login
PasswordAuthentication noEnforce key-only login