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:
- A system running Ubuntu 24.04 Noble Numbat.
- A user account with sudo privileges.
- 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.
-
Open the configuration file in your preferred text editor. Here, we’ll use
nano
:$ sudo nano /etc/ssh/sshd_config
-
Basic configurations to consider:
-
Change the default SSH port (optional but recommended for security):
Port 2222
Replace2222
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
-
Change the default SSH port (optional but recommended for security):
-
Save the changes and exit the editor. If you’re using
nano
, pressCTRL+X
, thenY
, andEnter
. -
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:
-
Allow the default SSH port (port 22):
$ udo ufw allow 22/tcp
If you changed the default port, replace22
with your chosen port number:$ sudo ufw allow 2222/tcp
-
Enable the firewall if it’s not already enabled:
$ sudo ufw enable
-
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.