Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux ssh command

Connect securely to a remote machine using its account and host name.

OpenSSH

Syntax

Command form
ssh [OPTION]... [USER@]HOST [COMMAND]

Common options

6 options
OptionWhat it does
-p PORTConnect to PORT on the remote host.
-i IDENTITY_FILEUse the specified private key file.
-J DESTConnect through a jump host.
-L [BIND:]PORT:HOST:HOSTPORTForward a local port to a remote destination.
-NDo not run a remote command; useful for forwarding only.
-vShow verbose connection diagnostics; repeat for more detail.

Usage examples

3 examples

Connect securely to a remote machine using its account and host name.

ssh user@server.example

Open a remote shell as alice.

ssh alice@example.com

Connect on a custom port using a selected key.

ssh -p 2222 -i ~/.ssh/id_ed25519 alice@example.com

Notes

Verify host keys and protect private keys. SSH options may be set in ~/.ssh/config; avoid disabling host-key checks as a routine fix.