Every server reachable on port 22 sees a steady stream of automated login attempts, which is why logs fill with failed passwords minutes after a server goes online. Key-only authentication makes those attempts harmless. Moving SSH to another port reduces log noise but isn't real security.
Facts
- Port
- 22
- Protocols
- TCP
- Service
- SSH
What uses port 22
SSH servers for remote shells, SFTP and scp file transfers, Git hosting (git@github.com uses port 22), and tunnels.
On a Mac
Your Mac listens on 22 only if Remote Login is on (System Settings › General › Sharing); launchd starts sshd on demand. Outgoing connections to 22 come from ssh, git and tools like Transmit or VS Code Remote.
sudo lsof -nP -iTCP:22Security
Port 22 on the internet attracts constant password-guessing bots. Use key authentication, disable password login on servers, and don't forward 22 from your router to a Mac.
Frequently asked questions
How do I open port 22 on a Mac?
Turn on Remote Login in System Settings › General › Sharing. macOS then accepts SSH connections on port 22; limit access to specific users there.
Is port 22 dangerous to have open?
It's a constant target for automated attacks. With key-only authentication and up-to-date software it's safe; with weak passwords it isn't.
Does GitHub use port 22?
Yes, for git@github.com. If your network blocks 22, GitHub also offers SSH on port 443 via ssh.github.com.