Connecting to your VPS via SSH (Secure Shell) is the primary way to manage your server. This guide covers connecting from every major operating system, setting up SSH keys, and securing your connection.
Finding Your VPS Credentials
Before connecting, locate your server details in the VirtFusion panel:
- Log in to VirtFusion from your BearHost dashboard
- Select your VPS instance
- Note the IP Address, Root Password, and SSH Port (default: 22)
If you have not set a root password, click Reset Root Password in VirtFusion to generate one.
Connecting from Windows
Using PuTTY
- Download PuTTY from putty.org
- Open PuTTY and enter your VPS IP in the Host Name field
- Ensure port is set to 22 and connection type is SSH
- Click Open
- Accept the host key fingerprint on first connection
- Log in as
rootand enter your password
Using Windows Terminal (Windows 10/11)
Open PowerShell or Windows Terminal and run:
ssh root@YOUR_SERVER_IP
Connecting from Mac or Linux
Open Terminal and run:
ssh root@YOUR_SERVER_IP
Accept the fingerprint when prompted, then enter your password.
Changing the Root Password
Once connected, change your root password immediately:
passwd
Enter and confirm your new password. Use at least 16 characters with mixed case, numbers, and symbols.
Creating a Non-Root User
Running as root is risky. Create a regular user with sudo privileges:
adduser deployer
usermod -aG sudo deployer
Test the new user:
su - deployer
sudo whoami # Should output: root
Setting Up SSH Key Authentication (Recommended)
SSH keys are far more secure than passwords. Generate a key pair on your local machine:
ssh-keygen -t ed25519 -C "your_email@example.com"
Press Enter to accept the default file location. Set a passphrase for extra security.
Copy the public key to your server:
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@YOUR_SERVER_IP
On Windows without ssh-copy-id, manually copy the contents of id_ed25519.pub and paste them into ~/.ssh/authorized_keys on the server.
Disabling Password Authentication
After confirming key-based login works, disable passwords:
sudo nano /etc/ssh/sshd_config
Set these values:
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin prohibit-password
Restart SSH:
sudo systemctl restart sshd
Essential First Commands
After your first login, run these commands:
apt update && apt upgrade -y # Update all packages
df -h # Check disk usage
free -m # Check RAM usage
uname -a # Check OS info
Troubleshooting
| Problem | Solution |
|---|---|
| Connection timed out | Verify IP address; check firewall/security group allows port 22 |
| Connection refused | Ensure SSH service is running: sudo systemctl status sshd |
| Permission denied | Double-check password or SSH key; verify user exists |
| Host key changed warning | Remove old key: ssh-keygen -R YOUR_SERVER_IP |
| Slow connection | Add UseDNS no to sshd_config |
Security Best Practices
- Install fail2ban to block brute-force attempts:
sudo apt install fail2ban -y - Change the default SSH port from 22 to a high port (e.g., 2222) in
/etc/ssh/sshd_config - Use a firewall:
sudo ufw allow 2222/tcp && sudo ufw enable - Keep your system updated regularly with
apt update && apt upgrade - Disable root login entirely once you have a sudo user configured