How to SSH Into Remote Computers Using Windows, Linux, and macOS

This comprehensive guide walks you through the process of connecting via SSH from Windows, Linux, and macOS.

SSH (Secure Shell) is a powerful tool that allows you to securely connect to and control a remote machine over a network. Whether you're managing a headless Linux server, configuring remote development environments, or administering network devices, SSH is an essential skill for IT professionals, developers, and enthusiasts alike.

This comprehensive guide walks you through the process of connecting via SSH from Windows, Linux, and macOS.

What You Need Before Connecting via SSH

Before you initiate a connection, make sure you have:

  • Remote Host Address – The IP address or domain name of the computer you want to connect to.
  • Username – The account on the remote system you wish to access.
  • Password or SSH Key – A method of authentication.
  • SSH Server – The remote machine must have SSH server software running (e.g., OpenSSH).

SSH from Windows

Option 1: Using Command Prompt or PowerShell (Built-in)

Recent Windows versions (10 and 11) include a native SSH client.

Steps:

  1. Press Win + S, type "cmd" or "PowerShell", and open it.

Enter the following command:
bash
CopyEdit
ssh username@remote_host

  1. Replace username with the remote system's username and remote_host with its IP address or domain.
  2. The first time you connect, you’ll be asked to verify the server's fingerprint. Type yes to continue.
  3. Enter your password when prompted to complete the connection.

Option 2: Using PuTTY (Graphical SSH Client)

Steps:

  1. Download PuTTY from the official website and install it.
  2. Launch PuTTY.
  3. In the “Host Name (or IP address)” field, enter the remote machine’s address.
  4. Set the port to 22 (default for SSH) and ensure “Connection type” is set to SSH.
  5. Click Open to initiate the session.
  6. When the terminal window appears, type your username and press Enter.
  7. Enter your password when prompted.

SSH from Linux

Most Linux distributions come with OpenSSH Client pre-installed.

Steps:

  1. Open your terminal (Ctrl + Alt + T).

Use the SSH command:
bash
CopyEdit
ssh username@remote_host

  1. Replace the placeholders accordingly.
  2. On first-time connections, you’ll be asked to verify the authenticity of the remote machine. Type yes.
  3. Input your password when prompted.

Tip: If OpenSSH is not installed, use your package manager to install it:

bash

CopyEdit

sudo apt install openssh-client    # For Debian/Ubuntu

sudo dnf install openssh-clients   # For Fedora

SSH from macOS

macOS includes an SSH client accessible via the built-in Terminal.

Steps:

  1. Open Terminal (Applications > Utilities > Terminal).

Type the command:
bash
CopyEdit
ssh username@remote_host

  1. If connecting for the first time, type yes when asked to confirm the authenticity of the host.
  2. Enter your password to complete the connection.

How to Use SSH Key Authentication

SSH keys provide a more secure and convenient way to log into remote systems without entering passwords every time.

Step 1: Generate SSH Key Pair

Run the following on your local machine:

bash

CopyEdit

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  • You'll be prompted for a file to save the key. Press Enter to accept the default (~/.ssh/id_rsa).
  • Optionally, add a passphrase for extra security.

Step 2: Copy the Public Key to the Remote Server

Use the ssh-copy-id command:

bash

CopyEdit

ssh-copy-id username@remote_host

Alternatively, manually add the content of ~/.ssh/id_rsa.pub to the remote machine’s:

bash

CopyEdit

~/.ssh/authorized_keys

Ensure correct permissions:

bash

CopyEdit

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

Step 3: Connect Using the SSH Key

Now connect with:

bash

CopyEdit

ssh username@remote_host

If you set a passphrase, you’ll be asked to enter it. Otherwise, the login will proceed automatically.

Using SSH with Graphical Applications (X11 Forwarding)

SSH isn’t just for command-line access — it can also forward GUI applications to your local machine.

On Linux:

  1. Make sure an X server (like Xorg) is running on your machine.

Enable X11 forwarding:
bash
CopyEdit
ssh -X username@remote_host

  1. Run graphical programs, and they will display on your local system.

On macOS:

  1. Install and run XQuartz (an X11 server for macOS).
  2. After XQuartz launches, open Terminal.

Connect using:
bash
CopyEdit
ssh -X username@remote_host

  1. Launch GUI apps from the SSH session.

Troubleshooting SSH Connections

Here are common fixes for connection issues:

Problem

Solution

Permission denied (publickey)

Ensure the SSH key is correctly installed on the remote machine and permissions are correct.

Connection refused

Confirm the SSH server is installed and running on the remote host (e.g., sudo systemctl status ssh).

Host key verification failed

Remove the outdated key from ~/.ssh/known_hosts and try again.

Timeout

Check firewall settings and verify the host is online and reachable.

Final Tips for Secure SSH Use

  • Use SSH keys over passwords whenever possible.
  • Disable root login on the SSH server (PermitRootLogin no in /etc/ssh/sshd_config).
  • Change the default port from 22 to reduce automated attacks.
  • Monitor SSH logs for suspicious activity (/var/log/auth.log or /var/log/secure).
  • Use firewall tools or fail2ban to protect against brute-force attempts.

By mastering SSH across different operating systems, you gain powerful remote control capabilities essential for system administration, cloud computing, and secure data transfers.

Support.Com Can Help!

If you’re still having trouble, consider reaching out to Support.Com for a personalized solution to all technical support issues.