How To

SSH Ubuntu Setup: Enable Secure Remote Access

Managing Linux systems remotely has become essential for developers, system administrators, and cybersecurity professionals. A proper SSH Ubuntu Setup allows you to securely access your Ubuntu machine from anywhere using an encrypted connection.

SSH, short for Secure Shell, is widely used for remote administration, file transfers, and server management. Ubuntu supports SSH through the OpenSSH server package, making setup simple even for beginners.

In this guide, you’ll learn how to install, enable, and secure SSH on Ubuntu 20.04, 22.04, and 24.04 systems.

Why SSH Ubuntu Setup Matters

SSH provides encrypted communication between devices, protecting login credentials and transferred data from interception. Once configured, you can manage servers remotely without physical access.

A complete SSH Ubuntu Setup also helps administrators:

  • Execute commands remotely
  • Transfer files securely with SCP or SFTP
  • Automate server tasks
  • Access systems over local or public networks

Because SSH is commonly targeted by attackers, configuring it properly is equally important for security.

How to Enable SSH Ubuntu Setup

Ubuntu does not always enable SSH by default on fresh installations. You must install the OpenSSH server package manually.

First, update your package list and install OpenSSH:

sudo apt updatesudo apt install openssh-server

After installation, Ubuntu automatically starts the SSH service.

To verify that SSH is active, run:

sudo systemctl status ssh

If the service is running correctly, you will see an “active (running)” status.

Next, allow SSH traffic through the firewall if UFW is enabled:

sudo ufw allow ssh

This step ensures remote devices can connect without being blocked.

Connect After SSH Ubuntu Setup

Once SSH is enabled, you can connect from another Linux, macOS, or Windows system.

Use the following syntax:

ssh username@ip_address

To identify your Ubuntu system’s IP address, run:

ip a

The first time you connect, Ubuntu asks you to verify the server fingerprint. After accepting it, enter your password to establish the session securely.

If you access your system through the internet, configure router port forwarding for port 22 and use your public IP address.

Improve SSH Ubuntu Setup Security

Although SSH is secure by design, additional hardening improves protection against automated attacks.

Consider these security practices:

Use SSH Keys

SSH key authentication is safer than passwords because attackers cannot easily brute-force private keys.

Generate a key pair with:

ssh-keygen

Change the Default SSH Port

Changing port 22 reduces exposure to automated scanning bots.

Edit the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Modify the port value and restart SSH afterward.

Disable Root Login

Prevent direct root access by setting:

PermitRootLogin no

inside the SSH configuration file.

Troubleshooting Common SSH Issues

If SSH connections fail, check whether the SSH service is running:

sudo systemctl status ssh

For firewall-related problems, verify UFW rules:

sudo ufw status

If you receive a “Host key verification failed” warning, remove the outdated fingerprint using:

ssh-keygen -R ip_address

Conclusion

A proper SSH Ubuntu Setup gives you secure remote access to your Linux systems while improving administrative flexibility. By installing OpenSSH, configuring firewall access, and applying security best practices like SSH keys and port changes, you can safely manage Ubuntu servers from virtually anywhere.

Whether you run a personal server or enterprise infrastructure, SSH remains one of the most important tools in Linux administration.

Cyber Defence

Recent Posts

Bash Scripting Best Practices Every Beginner Should Know

Introduction Bash scripting is a powerful way to automate Linux tasks, but writing a script…

1 day ago

How To Create A Self-Signed SSL Certificate Using Bash And OpenSSL

Introduction A self-signed SSL certificate is a certificate that is created and signed by the…

1 day ago

How To Debug Bash Scripts Using bash -x And set Commands

Introduction Debugging is an important part of Bash scripting. When a script does not work…

1 day ago

How To Use Cron Jobs With Bash Scripts For Automation

Introduction Cron jobs are used in Linux to run commands or Bash scripts automatically at…

1 day ago

How To Use Pipes In Bash Scripts For Command Chaining

Introduction Pipes are an important feature in Linux and Bash scripting. A pipe allows you…

1 day ago

How To Use grep, awk, And sed In Bash Scripts

Introduction The grep, awk, and sed commands are powerful text-processing tools in Linux. They are…

1 day ago