
In Linux Servers Root User means the Administrator User who control everything in the server. So as a root user there is a big responsibility comes with it, it must be protected. By default root user may be disabled in Different Linux Operating Systems like AlmaLinux, Ubuntu etc.
So to access Linux login you have to go through different default username like (Almalinux) then you have to enter (sudo -i) for root access.
And before that you must have to set a password for root user, to enable root login on your Linux server, first you need to set up password for your root user as it is not set during the OS installation.
Use following command to set root password:
sudo passwd root
This command will prompt to enter a new password then confirm password etc, it will update the root password. (Always use a strong password including special characters and password must be longer than 12 characters.)
#sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Now you have to enable root access as default, for this edit SSH configuration file and enable root login in it.
nano /etc/ssh/sshd_config
Find the line that starts with PermitRootLogin and make sure that line is not commented.
OLD: #PermitRootLogin prohibit-password
Change it to:
PermitRootLogin yes
Makesure to save the change in this file. And now you have to restart the SSH service, that restart will enable your changes.
Now you can access your server with root user as normal.
To disable the root user again you have to edit SSH Configuration file (/etc/ssh/sshd_config) and revert the change mentioned above.