Support article
How to Connect to Your VPS via SSH
Connect to your VPS via SSH from Windows, Linux and Mac: commands, SSH keys, port change and troubleshooting connection errors.
Introduction
SSH (Secure Shell) is how you access your VPS remotely and securely. When you connect via SSH, it’s as if you had the server’s screen in front of you: you can type commands, install programs and configure everything from your computer.
In this article you’ll see how to connect via SSH from any operating system, how to configure SSH keys for greater security, and how to resolve the most common connection errors.
What you need to connect
Before starting, you need three details you received by email when hiring the VPS:
- The IP address of your server, for example
192.168.1.100. - The username, usually
rootat first. - The password or a configured SSH key.
If you have a VPS at miHosting and can’t find these details, open a support ticket and we’ll resend them.
Connecting from Windows
Windows 10 and Windows 11 already include an SSH client, so you don’t need to install anything.
Option 1: PowerShell or Command Prompt
-
Open PowerShell or Command Prompt.
-
Type:
ssh root@your-server-ip -
The first time it will ask if you trust the connection. Type
yesand press Enter. -
Enter the password. It won’t show as you type it, that’s normal.
[Imagen sugerida: screenshot of the SSH connection in PowerShell]
Option 2: PuTTY
If you prefer a graphical interface, you can use PuTTY, a free SSH client:
- Download PuTTY from its official website.
- Open PuTTY.
- In Host Name (or IP address), enter your server’s IP.
- In Port, enter 22 (or the port you have configured).
- Click Open.
- Enter the username and password when prompted.
[Imagen sugerida: screenshot of the main PuTTY screen]
Connecting from Linux or Mac
Linux and Mac already have an SSH client installed by default.
-
Open the Terminal.
-
Type:
ssh root@your-server-ip -
Confirm the connection the first time by typing
yes. -
Enter the password.
On Mac, the Terminal is in Applications → Utilities → Terminal. On most Linux distributions, it opens with
Ctrl + Alt + T.
Changing the connection port
For security, many servers change the SSH port from 22 to another number (for example, 2222). If your server uses a different port, add -p:
ssh -p 2222 root@your-server-ip
If you changed the port and forget to put
-p, the connection will fail. Remember the port you configured.
Connecting with a user other than root
If you created a normal user (the recommended approach), connect with that user instead of root:
ssh myuser@your-server-ip
Once inside, you can run administrator commands by putting sudo in front:
sudo apt update
How to configure SSH keys (much more secure)
Passwords can be guessed with brute force attacks. SSH keys are impossible to guess and also save you from typing the password every time.
Step 1: Create the key on your computer
In your terminal (not on the server):
ssh-keygen -t ed25519
Press Enter on all questions to leave the default values. Two files are created:
- Private key: stays on your computer, never share it.
- Public key: the one you copy to the server.
Step 2: Copy the public key to the server
ssh-copy-id root@your-server-ip
It will ask for the password one last time.
Step 3: Check that it works
Connect again:
ssh root@your-server-ip
Now it should log in without asking for your password. If so, the SSH key is working.
Once you confirm the keys work, you can disable password access on the server. That’s the most secure configuration.
Save the configuration so you don’t type it every time
If you connect often, you can create a quick access. Edit (or create) the ~/.ssh/config file on your computer:
Host myserver
HostName your-server-ip
User root
Port 2222
From then on, you just have to type:
ssh myserver
Much faster and more convenient.
Useful tips
- Use SSH keys instead of passwords. It’s the most effective security measure for your server.
- Change the default SSH port. It reduces the automatic attacks your server will receive.
- Don’t disable password access until you confirm the keys work. Otherwise you’ll be locked out.
- Keep the private key somewhere safe. If you lose it, you’ll have to generate a new one. If someone copies it, they’ll be able to enter your server.
- Write down the IP and port. These are the details you always need to connect.
Common problems
Connection refused
The SSH service isn’t active or the firewall blocks the port. If you have recovery console access, log in and check:
systemctl status ssh
If it’s not active, start it:
systemctl start ssh
Connection timed out
The most common cause is the firewall blocking your connection or the IP being incorrect. Verify the IP is correct and that the firewall allows the SSH port.
Permission denied (access denied)
The username or password is incorrect. Check that you type the username and password correctly. If you use SSH keys, verify the public key is correctly copied to the server.
It asks for the password even though I have an SSH key
The public key may not be copied correctly, or the .ssh folder permissions aren’t correct. On the server, check:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
I changed the port and now I can’t get in
You forgot to open the new port in the firewall. Use the panel’s recovery console or contact support.
Frequently asked questions
Is SSH secure?
Yes. SSH encrypts all communication between your computer and the server. No one can intercept what you type, not even your password.
Can I connect from my phone?
Yes. There are SSH apps for Android and iOS, like Termius or JuiceSSH. Useful for emergencies, although for daily work a computer is better.
Do I need internet to connect?
Yes. The SSH connection is made over the internet, from your computer to the remote server.
Can I have several SSH keys?
Yes. You can create one key for work, another for personal use, etc. Each is saved with a different name and indicated in the configuration file.
What do I do if I lose my private key?
You’ll have to connect via recovery console (if your provider offers one), create a new key and copy it back to the server. That’s why it’s worth keeping the private key secure.
Access your VPS with confidence
Connecting via SSH is the most important skill for managing a VPS. Once you master it, you can do everything you need on your server from your own computer.
If you have a miHosting managed VPS, you don’t need to connect via SSH for routine tasks: our technicians manage the server for you. But if you have a self-managed VPS or want to access directly, this guide serves as a base. Open a ticket from your client panel if you need help with the connection.