Connecting to Your Server via SSH
Connect to your VPS or dedicated server using SSH from Windows, macOS, and Linux.
3 min read
Prerequisites
Before connecting, make sure you have:
- An active VPS or Dedicated Server with GoZen Host
- Your server’s IP address (found in your client area dashboard)
- Your root password or an SSH key pair
Connecting from Linux / macOS
Open your terminal and run:
ssh root@your-server-ip
You’ll be prompted for your password on first connection. Accept the host fingerprint by typing yes when asked.
Using an SSH Key (Recommended)
For better security, use key-based authentication instead of passwords.
1. Generate a key pair (if you don’t already have one):
ssh-keygen -t ed25519 -C "[email protected]"
2. Copy your public key to the server:
ssh-copy-id root@your-server-ip
3. Connect without a password:
ssh root@your-server-ip
Connecting from Windows
Option 1: Windows Terminal / PowerShell
Windows 10 and 11 include a built-in OpenSSH client. Open Windows Terminal or PowerShell and use the same commands as Linux:
ssh root@your-server-ip
Option 2: PuTTY
- Download PuTTY
- Enter your server IP in the Host Name field
- Ensure the port is set to 22 and connection type is SSH
- Click Open and log in with your credentials
Changing the Default SSH Port
For added security, you can change the default SSH port from 22 to a custom port. Allow the new port in your firewall first, and keep your current session open until you’ve tested the new port from a second terminal.
# Edit the SSH config
sudo nano /etc/ssh/sshd_config
# Find and change this line:
# Port 22
Port 2222
# Check the config for errors before applying it
sudo sshd -t
Then apply the change. The command depends on the operating system:
# Ubuntu 24.04 and newer (SSH is socket-activated)
sudo systemctl daemon-reload
sudo systemctl restart ssh.socket
# Ubuntu 22.04 and Debian
sudo systemctl restart ssh
# AlmaLinux / Rocky Linux (SELinux must allow the new port first)
sudo semanage port -a -t ssh_port_t -p tcp 2222
sudo systemctl restart sshd
Test from a second terminal with ssh -p 2222 root@your-server-ip before you close the first one.
Disabling Root Login
Disable direct root login and use a regular user with sudo privileges instead. Set up and test that user before you turn root login off.
# Create a new user
adduser deploy
# Grant sudo access (Ubuntu/Debian)
usermod -aG sudo deploy
# AlmaLinux / Rocky Linux: usermod -aG wheel deploy, then set a password with: passwd deploy
From your own computer, copy your SSH key to the new user, then log in as that user in a second terminal and check that sudo works:
ssh-copy-id deploy@your-server-ip
ssh deploy@your-server-ip
sudo -v
Only then turn off root login:
# Edit SSH config
sudo nano /etc/ssh/sshd_config
# Set:
PermitRootLogin no
# Make sure no file in sshd_config.d overrides it
sudo grep -r PermitRootLogin /etc/ssh/sshd_config.d/
# Check the config, then restart SSH
sudo sshd -t
sudo systemctl restart ssh # Ubuntu/Debian (on AlmaLinux/Rocky: sshd)
Troubleshooting
| Problem | Solution |
|---|---|
Connection refused | Check that SSH is running: sudo systemctl status ssh (AlmaLinux/Rocky: sshd) |
Connection timed out | Verify your firewall allows port 22 (or your custom port) |
Permission denied | Double-check your password or SSH key path |
Host key verification failed | Remove the old key: ssh-keygen -R your-server-ip |
Next Steps
Once connected, you can start configuring your server:
- First Boot VPS Setup - the first things to set up on a new server
- VPS Security Checklist - harden SSH, the firewall and updates
Last updated 21 Oct 2026, 00:00 +0300.