• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Disable Root Login on Oracle Linux

in Linux OS, Oracle Linux, Red Hat Enterprise Linux
How to Disable Root Login on Oracle Linux

Securing your Oracle Linux server is a crucial aspect of server administration. One of the most effective ways to improve security is by disabling the root login. In this blog post, we’ll guide you through the process of how to disable root login on Oracle Linux, step by step. But first, let’s understand why it’s essential to disable root login.

Why Disable Root Login?

Root is the superuser account in Linux systems, which has complete control over the system. If an attacker gains access to the root account, they can cause significant damage. Disabling the root login reduces the risk of unauthorized access by forcing users to log in with their individual accounts and then use sudo or su to gain root privileges when needed.

Now that we understand the importance of disabling root login, let’s dive into the process.

Step-by-Step Guide to Disable Root Login

1. Create a New User with Sudo Privileges

Before disabling the root login, you need to create a new user with sudo privileges. This user will be able to perform administrative tasks by using the sudo command. To create a new user, follow these steps:

sudo adduser newuser
sudo passwd newuser

Replace newuser with the desired username. After setting the password, grant the new user sudo privileges:

sudo usermod -aG wheel newuser

2. Test the New User’s Sudo Access

Log in as the new user and test the sudo access:

su - newuser
sudo ls /root

If you can access the /root directory, the new user has the correct sudo privileges.

3. Configure SSH for the New User

To enhance security, it’s advisable to use SSH keys instead of passwords for remote login. As the new user, generate an SSH key pair:

ssh-keygen -t ed25519 -C "[email protected]"

Replace “[email protected]” with your email address. Copy the public key to the authorized_keys file:

mkdir -p ~/.ssh
chmod 700 ~/.ssh
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

Now, transfer the private key (id_ed25519) to your local machine for future SSH logins.

How to Disable Root Login on Oracle Linux

4. Disabling Password Authentication

To further secure your server, disable password authentication by editing the SSH configuration file:

sudo vim /etc/ssh/sshd_config

Find the following lines and modify them as shown:

PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no

Save the file and restart the SSH service:

sudo systemctl restart sshd

5. Disable Root Login

Now, it’s time to disable the root login. Open the SSH configuration file:

sudo vim /etc/ssh/sshd_config

Find the line containing PermitRootLogin and modify it as follows:

PermitRootLogin no

Save the file and restart the SSH service:

sudo systemctl restart sshd

Root login is now disabled on your Oracle Linux server.

Additional Security Measures

Disabling root login is just one of the many ways to secure your Oracle Linux server. Here are a few more security measures you can implement:

  • Enable Two-Factor Authentication (2FA)
  • Install Fail2Ban to protect against brute-force attacks
  • Change the SSH Port to avoid automated attacks on the default port
  • Install a Firewall like ConfigServer Security & Firewall (CSF) to secure your server
  • Install Let’s Encrypt to provide SSL/TLS encryption for your websites
  • Keep your system and software packages up to date with regular updates and patches
  • Regularly review logs and user activity to monitor for suspicious behavior

Conclusion

Disabling root login is an essential step in securing your Oracle Linux server. By following this guide, you’ve not only disabled the root login but also created a new user with sudo privileges and secured your server with SSH keys. Additionally, we’ve provided links to further improve your server security.

Remember that securing a server is an ongoing process, and it’s essential to stay informed about the latest security practices and updates. By staying vigilant and implementing security measures, you can protect your Oracle Linux server and the data it contains.

ShareTweet
Previous Post

How to Enable 2FA on Oracle Linux

Next Post

How to Build a File Server on Oracle Linux

Related Posts

How to Install Flask on Rocky Linux

How to Install Flask on Rocky Linux

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.