DEV Community

John  Ajera
John Ajera

Posted on

2 1 1 1

Enabling SSH in Ubuntu Server

Introduction

SSH (Secure Shell) allows remote access to your Ubuntu server for administration, development, and troubleshooting. This guide walks you through enabling SSH on an Ubuntu server.

Steps

1. Update Package Lists

Before installing SSH, update your package lists:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

2. Install OpenSSH Server

Install the SSH server package to allow remote connections:

sudo apt install -y openssh-server
Enter fullscreen mode Exit fullscreen mode

3. Start and Enable the SSH Service

Once installed, start and enable SSH to run at boot:

sudo systemctl enable --now ssh
Enter fullscreen mode Exit fullscreen mode

4. Verify SSH is Running

Check the status of the SSH service:

sudo systemctl status ssh
Enter fullscreen mode Exit fullscreen mode

If running, you should see output similar to:

Active: active (running)
Enter fullscreen mode Exit fullscreen mode

5. Find Your Server’s IP Address

To connect remotely, find your server's IP address:

ip a
Enter fullscreen mode Exit fullscreen mode

Look for an IP under eth0 or ensXX (e.g., 192.168.X.X).

6. Connect via SSH

From another computer, use this command to connect:

ssh username@server-ip
Enter fullscreen mode Exit fullscreen mode

Replace username with your Ubuntu username and server-ip with the IP found in Step 5.

7. Configure Firewall (If Needed)

If you are using UFW, allow SSH traffic:

sudo ufw allow ssh
Enter fullscreen mode Exit fullscreen mode

Conclusion

You have successfully enabled SSH on your Ubuntu server. This allows secure remote access for managing your system. πŸš€


Have questions? Drop a comment below!

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay