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

groupdel Command in Linux: Remove a Group and Audit Files

The groupdel command in Linux removes a group from the system. It deletes the group's entry from /etc/group and /etc/gshadow,…

12 hours ago

wc Command in Linux: Count Lines, Words, Characters, and Bytes

The wc command in Linux counts lines, words, characters, and bytes in files or standard input. It…

12 hours ago

top Command in Linux: Monitor Processes and Resource Usage

The top command in Linux provides a real-time view of running processes and system resource usage. From…

12 hours ago

usermod Command in Linux: Modify User Accounts and Groups

The usermod command in Linux modifies existing user account attributes. You can use it to manage group…

12 hours ago

sort Command in Linux: Sort Text, Numbers, Columns, and More

The sort command in Linux reads lines from files or standard input and writes them to standard…

2 days ago

wall Command in Linux: Broadcast Messages to Logged-In Users

The wall command in Linux sends a message to the terminals of all currently logged-in users. The…

2 days ago