Skip to content
Back to Series SSH from Scratch
Networking

Introduction to SSH: What It Is, How It Works, and Why Every Server Uses It

Learn SSH from scratch: its brief history, the transport protocol and cryptography, how it differs from telnet, and your first remote server login.

A
Alif Afriza Author
· · 4 min read
Introduction to SSH: What It Is, How It Works, and Why Every Server Uses It

SSH (Secure Shell) is the most important protocol you use every day when you touch Linux, a server, or a network device, without even realizing it. This article is the starting point of the SSH curriculum from zero to advanced level.

The Problem SSH Solves

Before SSH existed, server administrators used telnet and rlogin. Both had a fatal flaw: all data, including passwords, was sent in plaintext. Anyone standing in the network path could read the contents of a login session just by monitoring packets.

In 1995, researcher Tatu Ylönen built a protocol that secured all of that communication. The result was SSH: a console session encrypted from start to finish, and it became the de facto standard for remote server management.

The Layers of the SSH Protocol

SSH is not a single function, but three protocol layers working together:

  • Transport layer: creates an encrypted connection between two machines, negotiates the key exchange algorithm, authenticates the host, and generates symmetric keys for the session.
  • Authentication layer: proves the user’s identity, with a password or a public key.
  • Connection layer: multiplexes several channels over one encrypted connection, including channels for an interactive shell, single command execution, and port forwarding.

This separation matters: a single SSH connection can open many things at once, such as a terminal session, a tunnel to a database port, and file transfers, all in one encrypted channel.

Core SSH Cryptography

SSH uses three types of cryptography in a single session:

  1. Asymmetric keys for key exchange (e.g. Curve25519 or RSA) and authentication.
  2. Symmetric encryption for session data (e.g. AES-256-GCM / ChaCha20-Poly1305), once the keys have been agreed upon.
  3. Message Authentication Code (MAC) to ensure data has not been altered and truly comes from the other party.

The basic principle: session keys are created together (perfect forward secrecy), then data flows encrypted with a fast cipher, and every packet is tagged with a MAC so it cannot be altered along the way.

Port 22 and Its Default

SSH uses TCP port 22 as the standard. The number 22 was chosen because it is easy to remember. The SSH server waits for connections on this port, and users connect to it with the syntax:

ssh pengguna@alamat-server

If the server port is different, add -p:

ssh -p 2222 pengguna@alamat-server

First Login: Host Verification

When connecting for the first time, SSH asks whether you recognize the server’s “fingerprint.” This is the fingerprint of the server’s public key, its permanent identity. The risk being prevented is a man-in-the-middle attack: an attacker impersonating the server.

Just check whether that fingerprint matches the one distributed by the server owner. Once you accept it, the host record is stored in ~/.ssh/known_hosts and the warning will not appear again for the same machine.

What SSH Can Do Beyond the Terminal

SSH is not just a console. Some of its offshoots:

  • scp / sftp: encrypted file transfer.
  • Port forwarding: opens secure access to remote services (covered in detail in a follow-up article).
  • rsync over ssh: data synchronization between machines.
  • X11 forwarding: runs graphical applications from a server, displayed on the local computer.

Each of these functions still goes through the same SSH channel, so its security is equivalent to a terminal session.

Closing

SSH is the foundation of server management: everything you do on a remote machine, encrypted and verified. Understanding the protocol layers and the role of cryptography means you are no longer “using SSH without knowing how,” and you are ready to move on to real server configuration.

Curriculum continuation: after understanding the basics, the next step is setting up your first OpenSSH server safely.

References

  • RFC 4253, The Secure Shell (SSH) Transport Layer Protocol, rfc-editor.org/rfc/rfc4253 (transport layer and key exchange).
  • RFC 4252, The Secure Shell (SSH) Authentication Protocol, rfc-editor.org/rfc/rfc4252 (user authentication).
  • RFC 4251, The Secure Shell (SSH) Protocol Architecture, rfc-editor.org/rfc/rfc4251 (three-layer architecture).
  • Man page ssh(1) and sshd(8) from OpenSSH (official syntax and option guide).
  • Daniel J. Barrett and Richard E. Silverman, SSH, The Secure Shell: The Definitive Guide, O’Reilly Media (in-depth reference book on the SSH protocol).
Open for Contributors

Your ideas deserve to be read by thousands of people.

ByteNesia is built for everyone. If you have experience, tutorials, or opinions about technology, write and share them here. Your name will be credited as a contributor.

Write anything: tool reviews, homelab tutorials, security tips, or your tech stories.

Discussion & Comments