toolrota

What is SSH: secure server connection, creating an SSH key and security tips

SSH is the standard way to manage a remote server safely. We explain how it works, how to create a key and security settings.

Serkan Akyürek··4 min read
What is SSH: secure server connection, creating an SSH key and security tips – SaaS & Cloud

When you want to connect to a VPS or cloud server and run commands, the basic tool you use is the SSH (Secure Shell) protocol. SSH sets up an encrypted channel between two machines so your commands and data can't be read on the network. This guide covers what SSH is, creating a key and security settings.

What is SSH?

SSH is a protocol that lets you connect securely from your computer to the command line of a remote machine. It is standard for server management, file transfer (SCP/SFTP) and automation. It replaced old unencrypted methods such as Telnet. For server concepts see our VPS and Linux guides.

How does it work?

An SSH connection
  1. 1

    The client connects to the server's address and port

  2. 2

    The server verifies its identity (host key)

  3. 3

    An encrypted channel is set up

  4. 4

    The user proves identity with a password or key

  5. 5

    A command-line session opens

On the first connection you are asked to confirm the server's fingerprint; this is to make sure you are connecting to the right server.

Password or key?

FeaturePasswordSSH key
SecurityOpen to guessing and brute forceMuch stronger
ConvenienceTyped each timeSet up once, comfortable to use
AutomationHardEasy
RiskWeak passwordTheft of the private key

Creating an SSH key

A key pair has two parts: the private key (stays with you) and the public key (goes on the server).

  1. Open a terminal (PowerShell on Windows, Terminal on macOS/Linux).
  2. Run the key-creation command: ssh-keygen -t ed25519
  3. Confirm the file location and set a strong passphrase.
  4. Copy the public key to the server (for example ssh-copy-id user@server).
  5. Connect with ssh user@server to test.

Don't share the private key, email it or put it in a public repository (see our API key security guide).

Basic commands

CommandFunction
ssh user@serverConnects to the server
ssh -p 2222 user@serverConnects on a different port
scp file user@server:/pathCopies a file
sftp user@serverA file transfer session
exitCloses the session

Security settings

  1. Use key login; turn off password login.
  2. Disable direct root login; connect as a normal user and elevate.
  3. Changing the default port reduces noise but isn't security on its own.
  4. Allow only needed addresses with a firewall (see our firewall guide).
  5. Use tools that block failed logins.
  6. Keep the server updated.
  7. Clean up unused keys regularly.
  8. You can add two-factor authentication (see our two-factor guide).

Common problems

  • Connection refused: the service may be off, or there's a port or firewall problem.
  • Permission denied: the username, key or permissions may be wrong.
  • Host key changed warning: the server may have been reinstalled; but also consider a real attack.
  • Timeout: may be a network or firewall problem.

Common mistakes

  1. Leaving root login open with a weak password.
  2. Sharing the private key or uploading it to a repository.
  3. Not putting a passphrase on the key.
  4. Accepting the fingerprint warning without examining it.
  5. Changing settings without a backup access path and locking yourself out.

Frequently asked questions

Is SSH the same as a VPN? No; SSH is a secure command-line connection to one machine, a VPN tunnels all network traffic.

Does SSH work on Windows? Yes, modern Windows versions have a built-in SSH client.

Is changing the port enough? No; keys and a firewall are needed.

Summary

SSH is the standard way to connect to servers securely. Use key login, protect the private key, disable password and root login and keep the server updated.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.