Saturday, September 26, 2026

How to Enable SSH Root Login on Oracle Enterprise Linux 9 (OEL9)

How to Enable SSH Root Login on Oracle Enterprise Linux 9 (OEL9)

 

While setting up an Oracle Enterprise Linux 9 (OEL9) server, I encountered an issue where I was unable to connect to the server remotely using the root user over SSH.

Interestingly, SSH access using a normal user worked without any issues.

 

This post explains the troubleshooting steps I followed and how I enabled SSH root login.

 

1. SSH Connection Using the Root User

I initially tried connecting to the OEL9 server from my Mac using the root account:

 

mallikarjunramadurg@APAC-FR2WVTDXR4 ~ % ssh root@192.168.1.101

root@192.168.1.101's password:

Permission denied, please try again.

root@192.168.1.101's password:

 

Even though I was entering the correct root password, the SSH connection was rejected with:

Permission denied, please try again.

 

2. SSH Connection Using a Normal User

To verify whether the SSH service itself was working, I tried connecting using the mallik user.

 

mallikarjunramadurg@APAC-FR2WVTDXR4 ~ % ssh mallik@192.168.1.101

mallik@192.168.1.101's password:

[mallik@ora96 ~]#

 

The connection worked successfully.

This confirmed that:

The server was reachable over the network.

The SSH service was running.

Password authentication was working for the mallik user.

The issue was specifically related to SSH access for the root user.

 

3. Testing Root SSH Login From the Server

I then logged in using the mallik account and tried connecting to the same server using SSH as root:

 

[mallik@ora96 ~]$ ssh root@192.168.1.101

root@192.168.1.101's password:

Permission denied, please try again.

root@192.168.1.101's password:

 

This produced the same result.

However, after entering the password, I was able to access the root shell through the server's local console via virtual box direct server access.

 

[root@ora96 ~]#

 

4. Verify Root Access Through the Console

To make sure the root account and password were working correctly, I logged into the server directly using the Web Console / VirtualBox console with the root account.

 

The root login worked successfully.

This helped narrow down the problem to SSH configuration rather than the root password itself.

 

5. Check the SSH Configuration

Next, I checked the SSH configuration files for the following parameters:

 

PermitRootLogin

PasswordAuthentication

 

I used:

 

[root@ora96 sshd_config.d]# grep -iE 'permitrootlogin|passwordauthentication' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf 2>/dev/null

 

The output showed:

/etc/ssh/sshd_config:#PermitRootLogin prohibit-password

/etc/ssh/sshd_config:#PasswordAuthentication yes

/etc/ssh/sshd_config:# PasswordAuthentication. Depending on your PAM configuration,

/etc/ssh/sshd_config:# the setting of "PermitRootLogin without-password".

/etc/ssh/sshd_config:# PAM authentication, then enable PasswordAuthentication

 

 

The important setting here is:

#PermitRootLogin prohibit-password

The PermitRootLogin setting controls whether the root account is allowed to log in through SSH.

 

In my case, SSH root login using a password was not enabled.

 

6. Enable SSH Root Login

I then modified the SSH configuration to explicitly allow root login and password authentication.

 

[root@ora96 sshd_config.d]# sed -i 's/^#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

[root@ora96 sshd_config.d]# sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config

 

After modifying the configuration, I restarted the SSH service:

 

[root@ora96 sshd_config.d]# systemctl restart sshd

 

The SSH service restarted successfully.

 

7. Test SSH Root Login From the Mac

I then tested the connection again from my Mac.

 

mallikarjunramadurg@APAC-FR2WVTDXR4 ~ % ssh root@192.168.1.101

root@192.168.1.101's password:

[root@ora96 ~]#

 

The root SSH login was now successful.

 

8. Test Root SSH Login From the Server

I also verified the configuration from the mallik user session:

 

[mallik@ora96 ~]$ ssh root@192.168.1.101

root@192.168.1.101's password:

[root@ora96 ~]#

 

This also worked successfully.

 

Conclusion

The issue was not related to the root password or the SSH service itself. The problem was caused by the SSH server configuration preventing password-based root login.

 

The key configuration changes were:

PermitRootLogin yes

PasswordAuthentication yes

 

After updating the SSH configuration and restarting sshd, I was able to successfully connect to the OEL9 server using the root account over SSH.

 

Important Security Note

Enabling direct SSH access for the root user with password authentication can increase the security risk of a server, particularly if SSH is exposed to untrusted networks or the internet.

 

For production environments, it is generally preferable to:

Use a regular administrative account.

 

Grant administrative privileges through sudo.

Use SSH keys instead of passwords.

Restrict SSH access using firewall/network controls.

Disable direct root SSH login when it is not required.

 

For a lab or test environment, however, enabling root SSH access can be useful when direct root access is specifically required.

 

🌱 Vismo Technologies – Learn • Practice • Grow

#VismoTechnologies #OracleRAC #Oracle19c #OracleDBA #RACTraining #OracleTraining #DatabaseTraining #OnlineTraining #LiveClasses #OracleCareers #OracleWorld #LearnPracticeGrow

 


No comments:

Post a Comment

Installing Oracle AI Database Free 26ai RPM on Linux x86-64

Installing Oracle AI Database Free 26ai RPM on Linux x86-64 Oracle AI Database Free 26ai can be installed on supported Linux platforms...