Lesson 6 | Root login problems |
Objective | List root login problems and their solutions. |
Root login problems
Occasionally, you might find that root is unable to log in. The most common cause
of this is a forgotten or changed root password. Scenarios that prevent users from logging in (such as not having a valid shell) do not prevent
root from logging in. This is fortunate, because root should always have access to the machine.
If you have forgotten your root password, follow these steps to change it:
- Reboot the system. Because you don't know root's password and consequently can't shut the machine down gracefully, you'll have to turn off the
computer's power.
- At the LILO prompt, type
linux single
.
- After some basic system boot steps, you'll be presented with a shell prompt, indicated by a hash (
#
). From here, simply type
passwd root
and change root's password.
One other scenario creates the illusion that root is unable to log in, but it's really just a security feature. Linux doesn't allow root to log in
from untrusted sources, such as FTP or pseudo-terminals created by
rlogin
or
telnet
. Linux requires root to log in from
trusted sources, such as the console or a secure shell.
Linux log in from root
Linux does not require root to log in from a trusted source such as the console or a secure shell. In fact, it is generally recommended to avoid logging in as the root user whenever possible, as this can pose a security risk. Instead, users should log in with a regular user account and use the sudo command to perform administrative tasks as needed.
By default, Linux allows any user to log in from the console or a secure shell if they have a valid username and password. However, system administrators can configure the system to restrict login access to specific users or groups, or to require additional authentication mechanisms such as key-based authentication or two-factor authentication.
Overall, while root access can be useful for performing certain tasks on a Linux system, it is not required for logging in from a trusted source such as the console or a secure shell. Users should always follow best practices for security and use non-root accounts whenever possible.
Note: It is usually a bad idea to change security feature, because doing so might expose root's password on the untrusted network. If you must change this behavior, then add valid login devices to the /etc/securetty
file.
The next lesson lets you use Linux tools to troubleshoot processes.