Skip to content

Connect to a Linux Server with SSH: A Beginner Guide

Admin
October 19, 2026
14 min read
Beginner
💻 Target OS: Ubuntu 24.04+ / Debian 12+ / RHEL 9+

Before you begin

  • Applies to:A private Linux lab with a working OpenSSH server and a regular account that can sign in with a password.
  • Where to start:Open Bash on the client. Use the server console when checking the server’s identity or recovering access.
  • What you need:Have the server address, lab username, console access, and the OpenSSH client tools ssh, ssh-keygen, and ssh-copy-id.
Guide tools
Guide tools
0/0 Steps (0%)

SSH opens an encrypted terminal session on another machine. Your commands run on that remote machine, so checking which machine you are using matters.

You will connect to an existing Linux lab server, verify its identity, and set up a login key. You need two machines or a client plus a Linux virtual machine. This guide begins with a working SSH server and password-enabled lab account; it does not configure a new internet-facing server.

Trusted lab address → Compare fingerprint → Keep private key safe → Confirm remote account

Trusted lab address → Compare fingerprint → Keep private key safe → Confirm remote account.

01

Check the Client Tools

Client

On the client: ssh -V prints the OpenSSH version. command -v prints where a tool is installed. You need all three tools before continuing. Linux distributions often provide ssh-copy-id in their OpenSSH client package; use the package manager guide if one is missing.

Run on: SSH client · Bash
ssh -V
command -v ssh-keygen
command -v ssh-copy-id
❯ What to expect
An OpenSSH version and paths for both tools.
If a path is missing, install the appropriate client package first.
02

Get the Server Fingerprint Through Its Console

Server Console

On the server console: use a trusted local console or hypervisor console to read the server’s Ed25519 public host-key fingerprint. -l lists a fingerprint and -f selects the public-key file. Keep this value for the next step. This key identifies the server; it is different from your personal login key.

Run on: Server console · Bash
sudo ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
❯ What to expect
A line beginning with 256 SHA256: followed by a fingerprint.
It ends with a host comment and (ED25519).
Your actual fingerprint must be obtained from your own server.
03

Connect and Verify the Server Identity

Client

On the client: the option -o HostKeyAlgorithms=ssh-ed25519 selects the same host-key type you checked. At the first-connection prompt, compare the complete SHA256 fingerprint with the trusted console result. Type yes only if they match, then enter the server account password. The server may already be known; in that case SSH does not repeat the prompt.

Run on: SSH client · Bash
ssh -o HostKeyAlgorithms=ssh-ed25519 [email protected]
❯ What to expect
First connection: an authenticity question with an ED25519 fingerprint.
After verification and authentication: a shell prompt on your server.
04

Confirm Which Machine You Are Using, Then Disconnect

Remote Session

Inside the SSH session: hostname displays the server’s name and whoami displays your remote username. exit closes the remote shell and returns you to the client. Check that the remote identity is the one you intended before running administration commands.

Run on: Remote SSH session
hostname
whoami
exit
❯ What to expect
Your server hostname, then your remote account name.
After exit: Connection ... closed, and your client prompt returns.
05

Create Your Personal Login Key on the Client

Client

Back on the client: create the .ssh directory if necessary. chmod 700 makes that directory accessible only to its owner. ssh-keygen -t ed25519 creates an Ed25519 key pair; -f chooses a dedicated filename and -C adds an identifying comment. Enter a strong, unique passphrase when prompted; it protects the private key on disk. No characters appear while typing it.

Run on: SSH client · Bash
mkdir -p "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
ssh-keygen -t ed25519 -f "$HOME/.ssh/configcorner_lab_ed25519" -C "ConfigCorner lab"
❯ What to expect
Two passphrase prompts, then paths for:
~/.ssh/configcorner_lab_ed25519 (private key)
~/.ssh/configcorner_lab_ed25519.pub (public key)
06

Install Only the Public Key on the Server

Client

On the client: ssh-copy-id adds your public key to the remote account’s authorized keys, preserving existing keys. -i selects your .pub file. It may ask for the server account password. This deliberately changes that account’s SSH authorization; use only your approved lab account.

Run on: SSH client · Bash
ssh-copy-id -i "$HOME/.ssh/configcorner_lab_ed25519.pub" -o HostKeyAlgorithms=ssh-ed25519 [email protected]
❯ What to expect
Normally: Number of key(s) added: 1.
If it reports the key already exists, do not repeatedly append it.
07

Test That Key Authentication Works

Client

On the client: -i selects your private key. IdentitiesOnly=yes selects the configured identity rather than trying every agent key. The last three options allow public-key authentication and disable password and keyboard-interactive fallbacks for this connection. You may still be asked for the local key passphrase; that is expected.

Run on: SSH client · Bash
ssh -i "$HOME/.ssh/configcorner_lab_ed25519" -o IdentitiesOnly=yes -o PreferredAuthentications=publickey -o PasswordAuthentication=no -o KbdInteractiveAuthentication=no [email protected]
❯ What to expect
A key-passphrase prompt, if the key is not already unlocked, then a remote shell.
A server-account password prompt should not be used for this test.
08

Verify the Remote Account and End the Session

Remote Session

Inside the new SSH session: verify the destination again, then disconnect. You have completed a key-authenticated login while retaining your original recovery access.

Run on: Remote SSH session
hostname
whoami
exit
❯ What to expect
The correct server name and account, then your client prompt.

If the connection does not work

MessageWhat to check next
Connection timed outConfirm the address, route/VPN, and firewall rules with the lab owner.
Connection refusedConfirm SSH is running and listening on the expected port through the server console.
Permission denied (publickey)Check the account, selected key, and public-key installation. An administrator can inspect SSH logs, ownership, permissions, and security labels.
Incorrect key passphraseUse the passphrase created on the client, rather than the server password.
No matching host key typeCheck server policy and supported algorithms through its console. Do not enable obsolete algorithms to force a connection.

References and next steps

Comments