| by Arround The Web | No comments

How to Configure and Enable the SSH Server on Rocky Linux 9

SSH is the short-term Secure Shell that provides a secure method to connect two systems remotely. This network protocol is essential for secure remote server administration, file transfer, and service access. SSH provides encrypted communication and strong authentication to protect the sensitive data. Moreover, SSH allows the users to establish a secure remote login on unsecured networks.

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:

sudo dnf update

After updating the system, run the following commands to start and enable the SSH services:

sudo systemctl start sshd

sudo systemctl enable sshd

You can also execute the following command to check the status of the currently running SSH:

sudo systemctl status sshd

Now, you can enable the access of the SSH service in the Firewall through the following command:

firewall-cmd --zone=public --permanent --add-service=ssh

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:

sudo vi /etc/ssh/sshd_config

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:

sudo systemctl restart sshd

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 --add-port=22/tcp --permanent

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.

Share Button

Source: linuxhint.com

Leave a Reply