SSH was developed to fulfill the remote access protocols like Telnet and Rsh vulnerabilities. However, the SSH server requires the correct configuration to work correctly. In this guide, you will learn about the method to configure and enable the SSH servers on Rocky Linux 9 (RHEL-based OS).
How to Configure and Enable the SSH Server on Rocky Linux 9
Before enabling the SSH service, you can update the system according to the available latest updates:
After updating the system, run the following commands to start and enable the SSH services:
sudo systemctl enable sshd
You can also execute the following command to check the status of the currently running SSH:
Now, you can enable the access of the SSH service in the Firewall through the following command:
How to Configure the SSH Server on Rocky Linux
To configure the SSH server, you need to modify the config file. Let’s take an example to configure and set up an SSH server. First, run the following command to open the SSH config file:
Now, you can customize the SSH settings. Here are a few things that you can modify:
- Port: SSH uses Port 22 as the default. If you want to change the port number, go to the #Port 22 line and then uncomment the line. Once you are done, change the port number accordingly.
- PermitRootLogin: The root login is disabled by default for security purposes, but you can change it as required.
- Password Authentication: The password authentication feature is enabled in the configuration, but you can disable it by uncommenting the line.
Save the config file to make the changes successful after modifying it. Now, restart the SSH service through the following command:
Furthermore, if you have to change the port, it is essential to allow the SSH port in the Firewall. You can do it through the following command:
sudo firewall-cmd --reload
Conclusion
SSH is the Secure Shell that allows you to establish a secure connection between two systems. This is how you can easily configure and enable the SSH servers on Rocky Linux 9. We also explained the method to enable the SSH server to allow the access to the Firewall to eliminate the chances of error while using the SSH server.