Ports / SSH

TCP port

Port 22: SSH

TCP port 22 is SSH: encrypted remote login and remote commands. SFTP and scp copy files over the same port.

  • The server proves who it is with its host key; the user logs in with a password or a key.
  • A server can listen on another port: ssh -p PORT reaches it.

Check port 22 on Linux

Put the server's name or address in place of HOST.

ss -tlnp 'sport = :22'
On the server: is a program listening on TCP port 22, on which address, and which program? How to read ss.
nc -zv HOST 22
From a client: does a TCP connection to port 22 open, get refused, or time out? How to read nc.
tcpdump -ni any tcp port 22
On either end: the packets to and from TCP port 22, as they cross the card. How to read tcpdump.
nmap -p 22 HOST
From outside: is TCP port 22 open, closed or filtered? How to read nmap.

What runs on it

SSH
Encrypted remote login and commands, on TCP port 22, with passwords or keys.
Bastion host
One hardened machine that is the only way into a private network.

Use port 22 on real machines

Open SSH: log in to a far machine and prove who's who

Sources

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab