DEV Community

Sospeter Mong'are
Sospeter Mong'are

Posted on

How to Access Your New Linux Server via SSH

Purchasing a new server is exciting, but you might wonder, "How do I actually access it?" If you've been given SSH credentials, connecting is straightforward. This guide will walk you through accessing your server securely using SSH (Secure Shell), whether you're on Windows, macOS, or Linux.


What You’ll Need

Before starting, ensure you have:

Server IP Address (e.g., 178.18.243.142)

SSH Port (usually 22)

Username (commonly root for full access)

Password (provided by your hosting provider)

In this example, we’ll use:

  • IP: 123.45.67.89
  • Port: 22
  • User: root
  • Password: xxxxyEfdF25E16dc

Step 1: Open a Terminal or SSH Client

Linux & macOS Users

  1. Open the Terminal (search for "Terminal" in apps).
  2. Proceed to Step 2.

Windows Users

You have two options:

Option 1: Using PowerShell (Recommended for Windows 10/11)

  1. Press Win + X and select Windows Terminal or PowerShell.
  2. Proceed to Step 2.

Option 2: Using PuTTY (Alternative GUI Method)

  1. Download PuTTY (if not installed).
  2. Open PuTTY, enter:
    • Host Name (or IP): 123.45.67.89
    • Port: 22
    • Connection Type: SSH
  3. Click Open, then enter root and the password when prompted.

Step 2: Connect via SSH

Run the following command in your terminal (Linux/macOS/PowerShell):

ssh root@123.45.67.89 -p 22
Enter fullscreen mode Exit fullscreen mode

(If the port is 22, you can omit -p 22.)

First-Time Connection Security Warning

You’ll see:

The authenticity of host '178.18.243.142' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Enter fullscreen mode Exit fullscreen mode

Type yes and press Enter.

Enter Your Password

Next, you’ll be prompted for the password:

root@178.18.243.142's password:
Enter fullscreen mode Exit fullscreen mode

Paste or type: xxxxyEfdF25E16dc (the text won’t show for security).


Step 3: You’re In!

If successful, you’ll see a command prompt like:

root@your-server:~#
Enter fullscreen mode Exit fullscreen mode

Now you have full control over your server!


Essential Next Steps

1. Change the Default Password

Running passwd will let you set a new, stronger password:

passwd
Enter fullscreen mode Exit fullscreen mode

2. Secure Your Server

  • Disable root login over SSH (use a sudo user instead).
  • Set up SSH key authentication (more secure than passwords).
  • Configure a firewall (e.g., ufw on Ubuntu).

3. Update Your System

Run:

apt update && apt upgrade -y  # For Debian/Ubuntu
yum update -y                # For CentOS/RHEL
Enter fullscreen mode Exit fullscreen mode

Troubleshooting Common Issues

"Permission Denied"

  • Double-check the username and password (they’re case-sensitive).
  • Ensure you’re using root (or the correct username).

"Connection Refused" or "Port 22 Closed"

  • Verify the server is running.
  • Check if a firewall is blocking port 22.
  • Some hosts use a different SSH port—confirm with your provider.

"SSH Command Not Found" (Windows)

  • Enable OpenSSH:
    • Go to Settings > Apps > Optional Features > Add "OpenSSH Client".
  • Alternatively, use PuTTY.

Conclusion

Accessing your server via SSH is the first step toward managing your hosting environment. Once connected, prioritize security updates and strong authentication to protect your system.

Need further help? Consult your hosting provider’s documentation or leave a comment below! 🚀


🔐 Pro Tip: Always use SSH keys instead of passwords for better security! Learn how to set them up in our SSH Key Setup Guide.

Top comments (0)