Site Tools


wiki:ssh-basics

Table of Contents

SSH Basics

SSH (Secure Shell) is a protocol for secure remote access. Connect with ssh user@host or ssh host (uses current username). SSH encrypts all traffic and authenticates both client and server.

$ ssh user@hostname             # connect to remote host
$ ssh user@192.168.1.100        # connect via IP address
$ ssh hostname "command"        # run command remotely and exit
$ ssh -v user@host              # verbose output (debugging)
$ exit                          # disconnect from remote host

The first connection prompts you to accept the host key (adds to ~/.ssh/known_hosts). Subsequent connections verify the key automatically. If a key changes unexpectedly, SSH warns you—this could indicate a man-in-the-middle attack.

Common options:

-p port             use non-standard SSH port
-u user             specify username
-i key              use specific private key
-v                  verbose (show details)
-N                  don't execute commands (useful for tunneling)
-f                  run in background
-o Option=value     pass SSH config option

SSH defaults to port 22. Some systems use different ports for security (e.g., port 2222). Use -p to specify.

wiki/ssh-basics.md · Last modified: by 127.0.0.1