How-to

SSH vs SSL/TLS: Two Locks for Different Doors

You use both on every dedicated server: SSH to manage the box, TLS to serve visitors. Knowing how each one trusts keys explains most of the setup steps.

What is the short answer?

SSH is a protocol for logging in to and controlling a remote machine. SSL, now properly called TLS, is a protocol for wrapping other application traffic, such as HTTP, SMTP or database connections, in encryption. Both use public key cryptography to agree on session keys and both encrypt everything after the handshake. The real differences are who uses them, how they decide which keys to trust and what runs inside the encrypted channel.

Is SSL still a thing?

Only as a name. Every version of SSL itself is broken and disabled in modern software; SSL 3.0 was formally deprecated in 2015. What people call an "SSL certificate" today is a TLS certificate, and current servers speak TLS 1.2 and TLS 1.3. On this page "TLS" means the protocol and "SSL" appears only where common usage insists on it.

How do they compare side by side?

AspectSSHTLS
Main jobRemote shell, file copy, tunnelsSecuring HTTPS, mail, APIs, databases
Default port22443 for HTTPS, others per protocol
Server identityHost key, trusted on first useCertificate signed by a public authority
Client identityUsually a key pair or passwordUsually none; the app handles login
Typical softwareOpenSSHOpenSSL, GnuTLS, BoringSSL, rustls
Who uses itAdmins and automationEvery visitor's browser

How does each decide whom to trust?

This is the deepest difference. SSH, by default, trusts a server the first time you connect: your client shows the host key fingerprint, you accept it, and it is stored in ~/.ssh/known_hosts. Any later change triggers a loud warning. That model works because admins are few and can check a fingerprint once.

TLS cannot ask millions of visitors to check fingerprints, so it relies on certificate authorities. Your browser ships with a list of trusted authorities, a website proves it controls its domain to one of them, and the authority signs a certificate. The browser checks that signature, the expiry date and the domain name on every connection. For a website on your machine, a free authority such as Let's Encrypt does the signing automatically.

SSH can also use certificates. OpenSSH supports its own lightweight certificate format, where an internal authority signs host and user keys. Large teams use it to avoid managing known_hosts and authorized_keys files by hand. These are not X.509 certificates and do not come from public authorities.

Which one do I set up on a new machine?

Both, for different reasons. SSH comes ready on every image we install; the panel shows the root password and can place your public keys at install time. TLS you add yourself for each public service:

apt-get install --no-install-recommends --yes python3-certbot-nginx   # pulls in certbot
certbot --nginx -d shop.example.net -d www.shop.example.net --agree-tos -m ops@example.net

On Rocky Linux and AlmaLinux, install certbot from EPEL with dnf install epel-release certbot python3-certbot-nginx. The renewal timer comes with the package, so certificates renew without a cron job.

Can one replace the other?

Not sensibly. You could tunnel web traffic through SSH with ssh -L, and that is handy for reaching an admin page that should never face the internet. But visitors cannot be expected to hold SSH keys, so public services use TLS. Going the other way, there are TLS-wrapped remote shells, but they lack the tooling, agent forwarding and file transfer that make SSH useful.

Do they share any weaknesses?

Both are only as strong as their key handling. A leaked SSH private key or a leaked TLS private key lets someone impersonate you or your server. Protect both with file permissions of 600, keep them off shared drives and rotate them when a person or system that held them leaves. Both also need current software: old OpenSSH and OpenSSL versions carry known flaws, so keep the image updated with apt upgrade or dnf upgrade.

What about speed?

After the handshake both use fast symmetric ciphers such as AES-GCM or ChaCha20-Poly1305, and every processor in our catalog accelerates AES in hardware. Neither will be your bottleneck on a 10 or 25 Gbps port for normal workloads.

Keep Reading

What is SSH?

The protocol behind every remote login to a Linux box: what it protects, where it came from and what you use it for daily.

Open

How SSH works

Follow one SSH connection from the TCP handshake through key exchange, host verification and login to channels and forwarding.

Open

SSH keys

How SSH key pairs replace passwords, how to make an ed25519 key and how to have it placed on your machine at install time.

Open

Telnet vs SSH

Why Telnet is never used for logins anymore, the one job it still does well and the modern tools that replace even that.

Open

FAQ

Quick Answers

No. SSH is for remote login and file transfer; SSL, now TLS, secures application traffic such as HTTPS.

By default it uses raw host and user keys. OpenSSH also has its own certificate format for teams, separate from TLS certificates.

No. SSH works with its own host keys. You need a TLS certificate only for services like HTTPS.

SSH listens on 22 by default; HTTPS over TLS uses 443.

Yes. Let's Encrypt issues free certificates, and certbot installs and renews them on every Linux image we offer.