Limiting Root Access
Rather than completely denying access to the root user, the administrator may want to allow access only via setuid programs, such as When a user executes the Once logged in via the Because this program is so powerful, administrators within an organization may wish to limit who has access to the command.
One of the simplest ways to do this is to add users to the special administrative group called wheel. To do this, type the following command as root:
In the previous command, replace You can also use the User Manager to modify group memberships, as follows. Note: you need Administrator privileges to perform this procedure.
Click the System menu on the Panel, point to Click the Users tab, and select the required user in the list of users.
Click Properties on the toolbar to display the User Properties dialog box (or choose Properties on the File menu).
Click the Groups tab, select the check box for the wheel group, and then click OK. Refer to Figure 46.2, "Adding users to the "wheel" group.".
Open the PAM configuration file for This change means that only members of the administrative group Groups pane illustration The root user is part of the The The basic format of the In the above example, Users of the The The Another advantage of the Administrators wanting to edit the To give someone full administrative privileges, type This example states that the user, The example below illustrates the granularity possible when configuring This example states that any user can issue the command The man page for su
or sudo
.
The
su
Commandsu
command, they are prompted for the root password and, after authentication, is given a root shell prompt.
su
command, the user is the root user and has absolute administrative access to the system[16]. In addition, once a user has become root, it is possible for them to use the su
command to change to any other user on the system without being prompted for a password.
usermod -G wheel
<username>
<username>
with the username you want to add to the wheel
group.
system-config-users
at a shell prompt.
su
(/etc/pam.d/su
) in a text editor and remove the comment # from the following line:
auth required /lib/security/$ISA/pam_wheel.so use_uid
wheel
can use this program.
Figure 46.2. Adding users to the "wheel" group.
wheel
group by default.The
sudo
Commandsudo
command offers another approach to giving users administrative access. When trusted users precede an administrative command with sudo
, they are prompted for their own password. Then, when they have been authenticated and assuming that the command is permitted, the administrative command is executed as if they were the root user.
sudo
command is as follows:
sudo
<command>
<command>
would be replaced by a command normally reserved for the root user, such as mount
.
sudo
command should take extra care to log out before walking away from their machines since sudoers can use the command again without being asked for a password within a five minute period. This setting can be altered via the configuration file, /etc/sudoers
.
sudo
command allows for a high degree of flexibility. For instance, only users listed in the /etc/sudoers
configuration file are allowed to use the sudo
command and the command is executed in the user's shell, not a root shell. This means the root shell can be completely disabled, as shown in "Disallowing Root Access".
sudo
command also provides a comprehensive audit trail. Each successful authentication is logged to the file /var/log/messages
and the command issued along with the issuer's user name is logged to the file /var/log/secure
.
sudo
command is that an administrator can allow different users access to specific commands based on their needs.
sudo
configuration file, /etc/sudoers
, should use the visudo
command.
visudo
and add a line similar to the following in the user privilege specification section:
juan ALL=(ALL) ALL
juan
, can use sudo
from any host and execute any command.
sudo
:
%users localhost=/sbin/shutdown -h now
/sbin/shutdown -h now
as long as it is issued from the console.
sudoers
has a detailed listing of options for this file.