Black Friday Sale is live: save up to 85% on Web & WordPress HostingView Deals
Step-by-Step TutorialServer Operations & SecurityBeginner

How to Connect to a Remote Server with SSH: Client Terminal Guide

Overview

The Secure Shell (SSH) protocol enables secure, encrypted command-line administration over unencrypted networks. When you connect via SSH, all keystrokes, commands, output, and file transfers are encrypted using strong modern ciphers (such as ChaCha20-Poly1305 or AES-GCM), preventing eavesdropping and man-in-the-middle attacks.

If SSH access is enabled for your hosting plan or server, you can manage files, inspect system logs, run Git deployments, and configure software packages directly from your local terminal.

In this guide, you will learn the anatomy of an SSH connection command, how to verify host fingerprints, how to specify custom ports and key files, and how to troubleshoot common connection issues.

[!NOTE] This tutorial uses documentation-safe IP addresses (192.0.2.1 from RFC 5737) and sample hostnames (example.com). Replace these with your server’s actual IP address or domain name.


Anatomy of the SSH Command

The basic syntax for initiating an SSH connection from your local terminal is:

ssh username@hostname_or_ip
  • ssh: The OpenSSH client utility.
  • username: The user account on the remote server (e.g., root, ubuntu, deploy, or your hosting account username).
  • @: The delimiter separating the username from the destination address.
  • hostname_or_ip: The public IPv4 address (e.g., 192.0.2.1) or fully qualified domain name (e.g., server.example.com).

Step 1: Initiating a Standard Connection

Open PowerShell (Windows) or Terminal (macOS/Linux) and enter the connection command:

ssh user@192.0.2.1

If connecting using a server hostname:

ssh deploy@your-server-hostname

Step 2: Verifying the Host Key Fingerprint

The very first time you connect to a remote server from your local computer, SSH displays a host key authenticity prompt:

The authenticity of host '192.0.2.1 (192.0.2.1)' can't be established.
ED25519 key fingerprint is SHA256:7uK+X9EXAMPLEFINGERPRINTSTRINGg4T1.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Why Does This Prompt Appear?

This prompt is a core security defense against man-in-the-middle (MITM) attacks. The client is asking you to verify that the server responding at that IP address is indeed the server you intended to contact.

  • If your hosting control panel or VPS welcome email lists the server’s public key fingerprint, compare it with the fingerprint displayed on screen.
  • If the fingerprint matches (or if you are provisioning a brand new server you just deployed), type yes and press Enter.

Once accepted, SSH appends the server’s public key to your local ~/.ssh/known_hosts file. On future connections, SSH verifies the server silently. If the host key ever changes unexpectedly in the future, SSH will abort the connection with a prominent security warning.


Step 3: Authenticating (Password vs. Key)

Depending on server configuration, SSH will prompt for authentication:

Scenario A: Password Authentication

If the server permits password authentication:

user@192.0.2.1's password:

Type your password and press Enter. Note that characters will not display on screen as you type.

Scenario B: Key-Based Authentication

If you generated an SSH key pair (see how to generate an SSH key pair) and authorized it on the server:

  • If your private key was saved in the default location (~/.ssh/id_ed25519), SSH offers it automatically.
  • If your key has a passphrase, enter your passphrase:
Enter passphrase for key '~/.ssh/id_ed25519':

Once verified, the remote shell prompt opens:

Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-generic x86_64)
user@server:~$

You are now authenticated and working inside the remote server environment.


Connecting on Non-Standard SSH Ports

While the default SSH port is 22, system administrators and hosting providers often change the SSH listening port (e.g., to 2222 or 22022) to reduce noise from automated internet bots scanning port 22.

To connect on a non-standard port, pass the -p flag followed by the port number:

ssh -p 2222 user@192.0.2.1

[!IMPORTANT] The port flag in ssh is lowercase -p. (Note: when using file-transfer tools like scp, the port flag is uppercase -P).


Connecting with a Specific Private Key File

If you manage multiple servers and have multiple SSH keys, you can specify exactly which private key file to use with the -i (identity) flag:

ssh -i ~/.ssh/id_ed25519_custom -p 2222 user@192.0.2.1

Troubleshooting Common Connection Issues

Error Message Common Cause Resolution
Connection timed out Firewall or wrong IP/port. Confirm the server IP is correct and that the hosting firewall or security group permits incoming traffic on that port.
Connection refused SSH service is not running or listening on a different port. Verify that the SSH service (sshd) is running on the server and check whether a non-standard port was assigned.
Permission denied (publickey) The server requires SSH keys, but your key was not accepted. Ensure your public key is added to ~/.ssh/authorized_keys on the server and that permissions are set to 600.
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! The server was reinstalled, IP re-assigned, or an active MITM attack is occurring. If you intentionally reinstalled your server OS, remove the old key using ssh-keygen -R 192.0.2.1.

When you finish working on the server, cleanly terminate your connection:

exit

Frequently Asked Questions

Does every web hosting plan include SSH access?

No. SSH provides direct command-line execution. On shared hosting environments, SSH access is frequently restricted or disabled by default for account isolation and security. On VPS and dedicated servers, full SSH shell access is standard. If SSH access is enabled for your hosting plan or server, you will find your SSH credentials in your welcome email or hosting management dashboard.

What should I do if SSH returns 'Permission denied (publickey)'?

This error indicates the server is configured to require SSH key authentication, but your client either did not provide a private key or provided a key whose public half is not listed in the server's ~/.ssh/authorized_keys file. Verify that your public key was copied correctly and that file permissions on ~/.ssh (700) and authorized_keys (600) are correct on the server.

How do I exit an active SSH session?

Type 'exit' (or press Ctrl+D) in your terminal. The remote shell will close, and control will return to your local prompt.

Need Technical Assistance?

Web Hosting Wale support is available 24/7. Tickets are typically answered within 10-15 minutes.

Open Support TicketView All Support Channels