How to connect to a VPS using SSH on Windows, macOS and Linux

How to Connect to a VPS Using SSH: A Step-by-Step Guide

Connecting to a virtual private server for the first time can feel technical, but the process is straightforward once you have the correct login details. Secure Shell, better known as SSH, gives you an encrypted way to access and manage a remote server from your computer.

In this guide, DigitalBerg explains how to connect to a VPS using SSH from Windows, macOS and Linux. You will also learn how to use a password or private key, connect through a custom SSH port and solve common connection errors.

What Is SSH?

SSH stands for Secure Shell. It is a network protocol used to create an encrypted connection between your local computer and a remote server. Once connected, you can run commands, install software, upload files, configure websites, review logs and perform other administrative tasks.

SSH is commonly used to manage a Linux VPS. A Windows VPS can also accept SSH connections when OpenSSH Server is installed and enabled, although many Windows server users still use Remote Desktop Protocol (RDP) for graphical access.

What You Need Before Connecting to a VPS

Before starting your VPS SSH connection, collect the following information from your hosting account or welcome email:

  • VPS IP address: The public IPv4 or IPv6 address of your server.
  • SSH username: Common examples include root, ubuntu, debian or a custom administrator username.
  • Authentication details: Either the account password or an SSH private key.
  • SSH port: The default port is 22, but your provider or server administrator may use a custom port.
  • An SSH client: Windows 10/11, macOS and most Linux distributions include an OpenSSH client. PuTTY is another option for Windows.

Never share your VPS password or private key. If you are unsure about any login detail, confirm it in your hosting control panel before repeatedly attempting to connect.

How to Connect to a VPS Using SSH on Windows

Modern Windows versions include an OpenSSH client, so you can connect through Windows Terminal, PowerShell or Command Prompt without installing extra software.

Step 1: Open a Terminal

Open the Start menu and search for Windows Terminal, PowerShell or Command Prompt.

Step 2: Enter the SSH Command

Use this command, replacing the example username and IP address with your own:

ssh username@server_ip

For example:

ssh [email protected]

Step 3: Verify the Server Fingerprint

During your first connection, SSH may warn you that the authenticity of the host cannot be established. Compare the displayed fingerprint with the fingerprint supplied by your VPS provider or administrator. If it matches, enter:

yes

This adds the server to your computer’s list of known hosts. Do not approve an unexpected changed fingerprint until you have verified why it changed.

Step 4: Enter Your Password

Type the VPS password and press Enter. The terminal usually does not display characters, dots or asterisks while you type. This is normal.

If the details are correct, the remote server’s command prompt will appear. You are now connected to your VPS using SSH.

How to Connect to a VPS Using SSH on macOS or Linux

macOS and most Linux distributions include an SSH client by default.

  1. Open Terminal.
  2. Run ssh username@server_ip.
  3. Verify the host fingerprint when prompted.
  4. Enter your password or SSH-key passphrase.

Example:

ssh [email protected]

When your remote shell prompt appears, the SSH connection is active.

How to Connect Through a Custom SSH Port

If your server does not use port 22, add the uppercase-sensitive -p option followed by the custom port number:

ssh -p 2222 username@server_ip

Example:

ssh -p 2222 [email protected]

Changing the port does not replace strong security controls, but it can reduce automated connection noise. Make sure the selected port is allowed by the server firewall and any cloud firewall or security group.

How to Connect to a VPS With an SSH Key

SSH key authentication is generally safer and more convenient than relying only on a password. A key pair contains:

  • A public key, which is stored on the VPS.
  • A private key, which stays securely on your computer.

The private key should never be emailed, posted online or uploaded to an untrusted service.

Generate a New SSH Key Pair

Run this command on your local computer:

ssh-keygen -t ed25519 -C "[email protected]"

Choose where to save the key and protect it with a strong passphrase. The default location is normally suitable for most users.

Add the Public Key to the VPS

On Linux or macOS, you may be able to copy the key with:

ssh-copy-id username@server_ip

Alternatively, copy the contents of your .pub file and add them to this file under the remote user’s account:

~/.ssh/authorized_keys

Your hosting control panel may also provide an SSH-key section where you can add the public key before creating or rebuilding the VPS.

Connect With a Specific Private Key

If the private key is not stored under its default name or location, specify it with -i:

ssh -i /path/to/private_key username@server_ip

Windows example:

ssh -i C:\Users\YourName\.ssh\digitalberg_key [email protected]

macOS or Linux example:

ssh -i ~/.ssh/digitalberg_key [email protected]

Using PuTTY to Connect to a VPS on Windows

If you prefer a graphical application, PuTTY remains a practical SSH client for Windows.

  1. Download PuTTY from its official website and install it.
  2. Open PuTTY.
  3. Enter the VPS IP address in Host Name.
  4. Enter the SSH port, normally 22.
  5. Select SSH as the connection type.
  6. Click Open.
  7. Verify the host key, then enter your username and password.

For key-based login, select your private key in Connection > SSH > Auth > Credentials before opening the connection. Depending on the PuTTY version and how the key was created, you may need a compatible PPK private-key file.

Can You Use SSH With a Windows VPS?

Yes, you can connect to a Windows VPS using SSH if OpenSSH Server is installed, running and permitted through the firewall. However, SSH provides command-line access; it does not display the normal Windows desktop.

Use SSH when you need secure command-line administration, scripting or file transfers. Use RDP when you need the graphical Windows interface. If the Windows VPS only has RDP enabled, an SSH connection will fail until OpenSSH Server is configured.

Useful SSH Commands After Login

Once connected, these basic Linux commands can help you inspect the VPS:

pwd             # Show the current directory
ls -la          # List files, including hidden files
cd /path        # Change directory
whoami          # Show the current user
hostname        # Show the server hostname
uptime          # Show uptime and load averages
df -h           # Show disk usage
free -h         # Show memory usage
exit            # Close the SSH session

Be careful with commands copied from unknown websites, especially when logged in as root. A command executed with administrator privileges can modify or delete critical server data.

Common VPS SSH Connection Errors and Fixes

Connection Timed Out

A timeout usually means your computer cannot reach the SSH service. Check the server IP address, SSH port, local internet connection and firewall rules. Also confirm that the VPS is powered on.

Connection Refused

This often means the server is reachable, but no SSH service is listening on that port. Confirm that the SSH service is running and that you are using the correct port.

On an Ubuntu or Debian server with console access, an administrator can check:

sudo systemctl status ssh

Permission Denied

The username, password or private key may be incorrect. Confirm the correct username and make sure the public key is installed for that same user. Also check that the server allows the authentication method you are trying to use.

Private Key Permissions Are Too Open

OpenSSH may reject a private key that other users can read. On macOS or Linux, restrict its permissions:

chmod 600 ~/.ssh/private_key

Host Key Has Changed

This warning can appear after a VPS rebuild or IP reassignment, but it can also indicate a security risk. Verify the new fingerprint through a trusted source before removing the old entry from known_hosts.

Use Verbose Mode for Troubleshooting

Verbose output shows which stage of the SSH connection is failing:

ssh -v username@server_ip

For deeper diagnostics, use -vv or -vvv, but review the output before sharing it because logs may reveal usernames, paths or server details.

SSH Security Best Practices for VPS Users

  • Prefer SSH keys over password-only authentication.
  • Protect every private key with a strong passphrase.
  • Keep your operating system and OpenSSH packages updated.
  • Use a non-root administrative account where practical.
  • Restrict SSH access with firewall rules when possible.
  • Consider rate limiting or tools such as Fail2ban to reduce repeated login attacks.
  • Disable password authentication only after confirming that key-based login works in a second session.
  • Keep a provider console or recovery method available before changing SSH settings.
  • Back up important data and configuration files before making server-level changes.

If you change SSH configuration, test the new login in a separate terminal before closing your existing session. This simple step can prevent an accidental lockout.

Why Choose DigitalBerg VPS Hosting?

A well-managed VPS gives you more control, dedicated resources and room to grow compared with basic shared hosting. DigitalBerg provides VPS hosting options for websites, business applications, development environments and other online workloads. Whether you need a Linux VPS for command-line control or a Windows VPS for Windows-based software, choose resources and an operating system that match your technical requirements.

Before ordering, consider CPU, RAM, SSD storage, bandwidth, operating system, management level, backups and the applications you plan to run. The right VPS plan should support your present workload while leaving reasonable capacity for future growth.

Conclusion

To connect to a VPS using SSH, you need the server IP address, username, SSH port and either a password or private key. Open a terminal, run ssh username@server_ip, verify the host fingerprint and authenticate. For a custom port, add -p; for a specific private key, add -i.

SSH gives you secure, direct control over a remote server, making it an essential tool for Linux VPS administration and a useful option for a properly configured Windows VPS. If a connection fails, check the address, port, firewall, SSH service and authentication details one at a time.

Frequently Asked Questions

What is the default SSH port for a VPS?

The default SSH port is 22. If your hosting provider or administrator uses a custom port, connect with ssh -p PORT username@server_ip.

Can I connect to a VPS using SSH from Windows?

Yes. Windows 10 and Windows 11 normally provide an OpenSSH client that works through Windows Terminal, PowerShell or Command Prompt. You can also use PuTTY.

Why is my VPS password not visible while I type it?

Most terminal-based SSH clients do not show characters or asterisks for passwords. Type the password carefully and press Enter.

Is SSH available on a Windows VPS?

It is available when OpenSSH Server is installed, running and allowed through the Windows firewall. SSH provides command-line access, while RDP provides graphical desktop access.

Is an SSH key better than a password?

SSH keys are generally more resistant to guessing and automated password attacks. Protect the private key with a passphrase and never share it.

How do I disconnect from a VPS?

Run exit and press Enter. You can also press Ctrl+D in most shells.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *