Home  »  ArticlesGuidesHow ToTechnologyTools   »   How to Install SSH Server on Ubuntu 24.04 Noble Numbat

How to Install SSH Server on Ubuntu 24.04 Noble Numbat

Secure Shell (SSH) is a cryptographic network protocol that allows secure remote login and other network services over an unsecured network. SSH is essential for system administrators, developers, and anyone needing to remotely access a server. In this guide, we’ll walk you through the steps to install and configure an SSH server on Ubuntu 24.04 Noble Numbat.

Prerequisites

Before we start, ensure you have the following:

  1. A system running Ubuntu 24.04 Noble Numbat.
  2. A user account with sudo privileges.
  3. Basic knowledge of using the terminal.

Step 1: Update Your System

First, make sure your system is up-to-date by running the following commands:

$ sudo apt update
$ sudo apt upgrade -y

Step 2: Install the OpenSSH Server

The most common SSH server implementation for Ubuntu is OpenSSH. Install it using the following command:

$ sudo apt install openssh-server -y

Step 3: Verify the SSH Server Installation

After the installation, the SSH server should start automatically. You can verify its status using:

$ sudo systemctl status ssh

You should see an output indicating that the SSH service is active and running.

Step 4: Configure the SSH Server

The SSH server configuration file is located at /etc/ssh/sshd_config. It’s a good practice to review and modify this file to enhance security and tailor the server settings to your needs.

  1. Open the configuration file in your preferred text editor. Here, we’ll use nano:
    $ sudo nano /etc/ssh/sshd_config
  2. Basic configurations to consider:
    • Change the default SSH port (optional but recommended for security):
      Port 2222
      Replace 2222 with any port number of your choice.
    • Permit root login (optional, not recommended for security reasons):
      PermitRootLogin no
    • Disable password authentication (if you are using key-based authentication):
      PasswordAuthentication no
  3. Save the changes and exit the editor. If you’re using nano, press CTRL+X, then Y, and Enter.
  4. Restart the SSH service to apply the changes:
    sudo systemctl restart ssh

Step 5: Allow SSH Through the Firewall

If you have a firewall enabled, you need to allow SSH traffic. Use the following commands:

  1. Allow the default SSH port (port 22):
    $ udo ufw allow 22/tcp
    If you changed the default port, replace 22 with your chosen port number:
    $ sudo ufw allow 2222/tcp
  2. Enable the firewall if it’s not already enabled:
    $ sudo ufw enable
  3. Check the firewall status:
    $ sudo ufw status
    You should see rules allowing SSH traffic.

Step 6: Test the SSH Connection

Now, you can test the SSH connection from another machine. Use the following command, replacing username with your actual username and server_ip with your server’s IP address:

$ ssh username@server_ip

If you changed the SSH port, use the -p option to specify the port:

$ ssh username@server_ip -p 2222

If everything is configured correctly, you should be prompted to enter your password or use your SSH key for authentication.

Conclusion

Congratulations! You have successfully installed and configured an SSH server on Ubuntu 24.04 Noble Numbat. With SSH, you can securely manage your server remotely, perform file transfers, and more. Remember to keep your system and SSH server updated to ensure security and performance.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Available under:
Articles, Guides, How To, Technology, Tools