SSH (Secure Shell) is an application layer cryptographic network protocol used for secure remote operating system management and encrypted data communication over insecure networks. By encrypting all transmitted traffic—including login credentials, commands, and session output—it protects server administration from eavesdropping and tampering. Because of this end-to-end protection, SSH is the standard method for accessing Linux servers, cloud instances, and network infrastructure.
How it works
SSH operates on a client-server model, typically listening on TCP port 22. When an SSH client initiates a connection, the server sends its public host key so the client can verify the machine's identity and prevent man-in-the-middle attacks. Both sides then negotiate encryption algorithms and perform a cryptographic key exchange to generate a shared session secret.
Once the encrypted channel is active, the client authenticates using a password or, more securely, asymmetric key pairs such as Ed25519 or RSA. After authentication succeeds, symmetric encryption algorithms like AES or ChaCha20 secure ongoing data transfer, while message authentication codes verify integrity. Beyond interactive shell access, SSH supports several core workflows:
- Executing remote commands and managing system services.
- Transferring files securely using
SFTP(SSH File Transfer Protocol) andSCP(Secure Copy). - Creating encrypted tunnels to forward local or remote TCP ports.
For stronger authentication, administrators generate Ed25519 key pairs using ssh-keygen, which deliver strong cryptographic protection with compact key sizes. For step-by-step setup instructions, see SSH Key Configuration: A Professional Guide to Secure Access.
Example
To connect to a remote server using a specific private key and custom port, run the following command from your local terminal:
ssh -i ~/.ssh/id_ed25519 -p 2222 [email protected]
On the server side, administrators harden the OpenSSH daemon by editing /etc/ssh/sshd_config to disable root logins and password authentication:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
What matters when choosing a server or hosting
When evaluating a VPS, dedicated server, or cloud hosting provider, verify how SSH access is provisioned and controlled:
- Full root or sudo access: Managed shared hosting often restricts or disables SSH, whereas VPS and cloud instances provide full shell privileges for installing packages and configuring services.
- Key injection at provisioning: Look for control panels that let you attach your public SSH key during server creation so password login is never exposed on the public internet.
- Out-of-band console access: A browser-based serial or VNC console is essential for recovery if a firewall rule or broken
sshd_configlocks you out of SSH.
Common mistakes
- Leaving password authentication enabled: Automated bots continuously scan port 22 for weak credentials; enforcing key-based authentication blocks the vast majority of brute-force attempts.
- Setting overly permissive file permissions: OpenSSH refuses to use private keys if
~/.sshor~/.ssh/authorized_keysis readable by other users. Set directory permissions to700and key file permissions to600. - Restarting SSH without testing the configuration: Always run
sshd -tto check syntax and keep an active session open before restarting the SSH service. - Ignoring host key warnings: Blindly clearing
known_hostserrors without verifying whether a server was rebuilt can expose your session to interception. Review SSH Key Configuration: A Professional Guide to Secure Access to audit key handling practices.
FAQ
What is the difference between SSH and Telnet?
Telnet transmits all data, including usernames and passwords, in plain text, making it vulnerable to network sniffing. SSH encrypts the entire connection and verifies server identity, replacing Telnet for remote administration.
Which SSH key algorithm should I choose?
Ed25519 is the recommended default on modern systems because it is fast, resists side-channel attacks, and uses short keys. Use RSA with at least 3072 or 4096 bits only when connecting to legacy systems that lack Ed25519 support.
Does changing the default SSH port make a server secure?
Moving SSH from port 22 to a high custom port reduces automated scan noise in system logs, but it is not a standalone security control. Combine it with key-based authentication, firewall rules, and fail2ban.