₹200 free credit when you verify after signup, plus your first recharge doubled. Credit after KYC, valid 15 days (extendable once). Bonus on first top-up of ₹500+, max ₹50,000, expires after 120 days. Promotional credit is never refunded as cash. Offer terms
Engineering blog

How to connect to a Linux VPS with SSH from Windows, Mac or Linux

By BookMyHost Engineering · Published · Updated · 10 min read

Every Linux server you rent, from any provider, is managed the same way: you open a terminal on your own computer and connect to the server over SSH (Secure Shell). Whether you have just ordered a Linux VPS hosting in India on a KVM VPS or a server somewhere else, the first login looks the same, and it takes about a minute once you know where the three pieces of information are.

Short version: find the server's public IP address, the username (usually root) and the password in your provider's panel. On Windows 10/11, macOS or Linux, open a terminal and run ssh root@YOUR_SERVER_IP, type yes to accept the host key, then enter the password. You do not need to install anything. If the connection fails, the error message tells you which of four things is wrong, and the provider's web console lets you in even when SSH is broken.

Commands tested on Ubuntu 24.04 LTS, November 2026.

The commands below were written for a server running Ubuntu 24.04 LTS and a client running Windows 11, macOS or a current Linux desktop. They work the same on Debian 12, AlmaLinux 9 and Rocky Linux 9 unless a difference is noted. The examples use 203.0.113.10 as the server address; replace it with your own.

What you need before you connect: IP address, username, password or key

You need three things, and all three come from your provider:

  • The public IP address of the server, for example 203.0.113.10. It is shown on the server's page in the control panel.
  • The username. On most VPS providers it is root. Some cloud images disable root login and give you a named user instead (ubuntu on Ubuntu images, debian on Debian images) that can run commands with sudo. If root is rejected, check the provider's documentation before assuming the password is wrong.
  • A password or an SSH key. Either the provider generates a root password and shows it once, or you uploaded a public key when you ordered and the server only accepts that key.

You also need the port number, which is 22 unless your provider or a previous administrator changed it.

One thing people miss: copy the password carefully. Many panels show it once. If you have lost it, use the panel's password reset rather than guessing; repeated wrong guesses can get your own IP address blocked by tools such as fail2ban on the server.

Connect from Windows 10/11 with the built-in OpenSSH client

Windows 10 (version 1809 and later) and Windows 11 ship with the OpenSSH client. Open Terminal or PowerShell from the Start menu and check that it is there:

ssh -V

If you get a version string, connect:

ssh root@203.0.113.10

The first time you connect to a server, SSH shows the server's host key fingerprint and asks whether to continue:

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

Type yes and press Enter. The fingerprint is saved to a file called known_hosts in the .ssh folder of your user profile, and you will not be asked again for this server. Then type the password. Nothing appears on screen while you type, not even dots; that is normal. Press Enter and you land at a shell prompt on the server.

If the server uses a non-standard port, add -p:

ssh -p 2222 root@203.0.113.10

If ssh is not recognised, the optional feature has been removed. Open Settings, go to System, then Optional features, and add OpenSSH Client. Microsoft documents this in its OpenSSH for Windows guide.

Connect from Windows with PuTTY

PuTTY is still a reasonable choice if you are on an older Windows version or you like a window with saved sessions. Download it only from the official PuTTY site, since fake download pages exist.

  1. Open PuTTY. In Host Name (or IP address) enter 203.0.113.10.
  2. Leave Port at 22 and Connection type at SSH.
  3. Type a name under Saved Sessions and click Save so you do not have to retype it.
  4. Click Open. Accept the host key alert on the first connection.
  5. At login as: type root, press Enter, then type the password.

To paste in PuTTY, right-click inside the window. To copy, just select text with the mouse.

PuTTY uses its own key format (.ppk). If you plan to use SSH keys with PuTTY, generate or convert them with PuTTYgen, which is installed alongside it, and load the key under Connection, SSH, Auth, Credentials in the session settings.

Connect from macOS or a Linux desktop

Both have the OpenSSH client installed already. On macOS open Terminal (Applications, Utilities). On Linux open your terminal emulator. The command is the same as on Windows:

ssh root@203.0.113.10

Accept the host key with yes, enter the password, and you are in. To leave the server, type exit or press Ctrl+D.

If you connect to the same server often, add an entry to ~/.ssh/config on your own computer so you can type a short name instead of the address:

Host myvps
    HostName 203.0.113.10
    User root
    Port 22

After saving the file, ssh myvps does the same as the full command. The same file works on Windows at C:\Users\YourName\.ssh\config.

Log in with an SSH key instead of a password

A key pair replaces the password with a file that cannot be guessed. You keep the private key on your computer; the server holds the matching public key. This is what you should use for anything beyond the first login.

Step 1: create a key pair on your own computer (not on the server). The command is the same on Windows, macOS and Linux:

ssh-keygen -t ed25519 -C "my-laptop"

Press Enter to accept the default file location. Set a passphrase when asked; it protects the key if your laptop is lost or stolen.

Step 2: copy the public key to the server. On macOS and Linux there is a helper:

ssh-copy-id root@203.0.113.10

Windows does not include ssh-copy-id. In PowerShell, this one line does the same job:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@203.0.113.10 "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Either way you enter the server password one last time.

Step 3: test it. Open a new terminal window and connect again:

ssh root@203.0.113.10

This time you should be asked for the key's passphrase (or nothing at all, if you set none) instead of the server password. Keep the first session open until this works, so a mistake does not lock you out.

Only the .pub file ever goes to a server. Never copy, email or paste the private key (id_ed25519 without the extension) anywhere.

Fix common errors: connection refused, timed out, permission denied, host key changed

SSH error messages are short, but each one points at a specific cause.

Connection refused

ssh: connect to host 203.0.113.10 port 22: Connection refused

Your packet reached the machine and was rejected. The likely causes, in order:

  • The SSH service is not running (the server is still booting, or the service has crashed or been stopped).
  • SSH listens on a different port. Try -p with the port your provider states.
  • A firewall on the server is rejecting, rather than dropping, connections to port 22.

Wait a minute and retry if the server was just created or rebooted. If it persists, use the web console (next section) and check the service. On Ubuntu 24.04 the service is called ssh:

sudo systemctl status ssh
sudo ss -tlnp | grep -E ':22\b'

On AlmaLinux and Rocky Linux the service is sshd.

Connection timed out

ssh: connect to host 203.0.113.10 port 22: Connection timed out

Nothing answered. Check these:

  • The IP address is typed correctly, and the server is powered on in the panel.
  • A firewall on the server (UFW, firewalld) or a firewall or security group at the provider is dropping port 22.
  • Your own network blocks outbound port 22. Some office and campus networks do. Try from a mobile hotspot; if it works there, the block is on your side.

Permission denied

root@203.0.113.10: Permission denied (publickey,password).

The server is reachable and SSH is running, but it did not accept you. The list in brackets shows which methods the server allows.

  • Wrong username or password. Copy and paste the password instead of typing it, and check for a trailing space.
  • If the list shows only publickey, password login is turned off and you need the key that was installed on the server.
  • Your key is not being offered. Point at it explicitly with ssh -i ~/.ssh/id_ed25519 root@203.0.113.10.
  • Wrong permissions on the server: ~/.ssh must be 700 and authorized_keys must be 600, both owned by the user you log in as.

Running ssh -v root@203.0.113.10 prints each step of the handshake and usually shows which key was tried and why it was refused.

Host key changed

@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @

The server at that address is presenting a different host key from the one your computer saved. If you have just reinstalled the operating system, or the provider gave you an IP address that you used for a different server earlier, this is expected. Remove the old entry and connect again:

ssh-keygen -R 203.0.113.10

If you did not reinstall or change anything, stop and find out why before connecting. This warning exists to tell you that you may be talking to a different machine.

Locked out? Use the provider's web (VNC) console

Every serious VPS provider offers a console in the control panel, sometimes labelled VNC console, web console or remote console. It shows the server's screen and keyboard as if you were standing in front of it, and it does not go through SSH or the server's network configuration. That makes it the way back in when:

  • you enabled a firewall and forgot to allow SSH,
  • you edited sshd_config and the service no longer starts,
  • you changed the SSH port and cannot remember it, or
  • a network setting inside the server is broken.

Log in at the console with the root password, then fix the cause. Typical repairs on Ubuntu 24.04:

sudo sshd -t                    # prints the line number of any config error
sudo ufw allow OpenSSH          # if UFW is blocking port 22
sudo systemctl restart ssh

If you have also lost the root password, use the panel's password reset. Console sessions are awkward for long work (copy and paste is limited), so use them to repair SSH and then go back to a normal terminal.

What to do right after your first login

A new server with a public IP starts receiving automated login attempts almost immediately. Do these four things in the first session:

  1. Change the root password if the provider emailed it or you pasted it anywhere: run passwd.
  2. Update the system: apt update && apt upgrade on Ubuntu and Debian, dnf upgrade on AlmaLinux and Rocky Linux.
  3. Set up SSH key login as described above, and confirm it works from a second terminal.
  4. Create a normal user with sudo and stop using root for daily work.

Once key login works, turn off password login in /etc/ssh/sshd_config and enable a firewall that allows only the ports you use. Keep one session open while you make those changes and test from another.

If you have not chosen a server yet, our checklist for buying a VPS in India covers what to compare before you pay.

Connecting to a BookMyHost server

On BookMyHost, the IP address and login appear on the server page as soon as the server is running, usually under a minute after payment. Linux images include Ubuntu 22.04 and 24.04, Debian 12, AlmaLinux 8 and 9, Rocky Linux 9 and CentOS Stream, and you get root access on all of them.

Two panel features matter for this tutorial. Reset password sets a new root password and shows it once. Open console opens a browser console in a new tab that works even when the network or the firewall inside the server is misconfigured; the server must be running for it to connect. The guide to the panel shows where to open the server console from the panel and how to take a snapshot before risky changes. The Android app can open the console and an SSH session as well.

Plans and sizes are on the pricing page.

FAQ

Questions on this post

What is the default SSH port and username on a VPS?

SSH listens on TCP port 22 unless someone has changed it. The username depends on the provider and the image: many providers give you root, while some cloud images use a named user such as ubuntu or debian and expect you to use sudo. The server page or the welcome email from your provider states the exact username, so check there before guessing.

Do I still need PuTTY on Windows 11?

No. Windows 10 (version 1809 and later) and Windows 11 include the OpenSSH client, so you can open Terminal or PowerShell and run ssh root@your-server-ip. PuTTY still works and some people prefer its saved sessions, but it is no longer required and it uses its own .ppk key format.

Why does SSH say 'connection refused' or 'connection timed out'?

Connection refused means your packet reached a machine and nothing accepted it on that port: the SSH service is stopped, it listens on a different port, or a firewall actively rejected you. Connection timed out means nothing answered at all: the IP address is wrong, the server is powered off, or a firewall on the server, at the provider or on your own network is silently dropping the traffic.

Is logging in with a password over SSH safe?

The password is encrypted in transit, so nobody on the network path can read it. The risk is guessing: any server on a public IP receives automated login attempts all day, and a short or reused password will eventually be found. Use a long random password for the first login, then switch to SSH keys and turn password login off.

Run it on hourly billing

NVMe cloud servers in India, resize in place, GST invoice either way. Every new account starts with ₹200 of free credit.

Build a server
Get the app

Your cloud, in your pocket

Start, stop and reboot servers, open the console, watch live graphs, top up the wallet and chat with support, from the free BookMyHost Cloud app.

Get BookMyHost Cloud on Google Play iPhone app coming soon

See everything the app does →