View on GitHub


Harsh Kapadia's Computer Networking knowledge base.

Secure Shell (SSH)

(Back to Home)

Table of Contents


Authentication Methods

The Need for SSH

Generating Keys

Sharing Keys with the Server

The authorized_keys file in the .ssh directory on the server usually holds all the public keys from clients that are allowed to connect with the server. How do those public keys get there, though?

There are usually two ways to do this:

Building Blocks of SSH

SSH uses an underlying reliable connection protocol or service over which it enables secure communication and other services. The underlying connection protocol is almost always TCP, but other protocols like WebSocket can theoretically be used as well.

On top of TCP, SSH has three parts, namely the SSH Transport Layer Protocol, the SSH User Authentication Protocol and the SSH Connection Protocol

A SSH Connection


  • C = Client
  • S = Server
  • -> = Arrow indicating the direction of communication
  • ACK = TCP Acknowledgement flag
  • PSH = TCP Push flag


Algorithm Negotiation

Key Exchange Phase

Learn about Elliptic Curve Diffie-Hellman (ECDH).

End of Key Exchange

Subsequent Encrypted Communication

Connection Termination