Step 1: Edit the SSH Configuration File
- Open the SSH configuration file using a text editor. You can use - nano,- vi, or any other text editor you prefer. Here, we'll use- nano:bash- 1sudo nano /etc/ssh/sshd_config
- Look for the line that says: plaintext- 1PermitRootLogin no- If it exists, change it to: plaintext- 1PermitRootLogin yes- If the line does not exist, you can add it. 
- Save the changes and exit the editor. In - nano, you can do this by pressing- CTRL + X, then- Yto confirm, and- Enterto save.
Step 2: Restart the SSH Service
After making changes to the SSH configuration, you need to restart the SSH service for the changes to take effect:
bash1sudo systemctl restart sshd
Step 3: Configure Firewall (if applicable)
If you have a firewall enabled, ensure that SSH traffic is allowed. You can do this with the following commands:
bash1sudo firewall-cmd --permanent --add-service=ssh 2sudo firewall-cmd --reload
Step 4: Set a Strong Password for the Root User
If you haven't already set a strong password for the root user, you can do so with the following command:
bash1sudo passwd root
Step 5: Verify SSH Access for Root
You can now attempt to SSH into your CentOS 9 server as the root user. Use the following command, replacing server_ip with the actual IP address of your server:
bash1ssh root@server_ip
