Redhat: Sudo

From Define Wiki
Revision as of 10:00, 2 September 2013 by Michael (talk | contribs) (→‎sudo and su)
Jump to navigation Jump to search

The Root User

The Root user is the all powerful user on the system. If a cracker was to take control of the root user they would have full control of the system.

Most commands should be run as a regular user, as the limits on regular users can protect the system. But for certain purposes a user may need to take root privileges using the sudo, su and sg commands.


su

A regular user with the ability to log in as root, can take root privileges temporarily using the sudo and su commands. The su command will prompt the user for the root password.

[michael@head ~]$ su -
Password:
[root@head ~]#


Adding a username will allow you to log in as that user as long as you have the password.

su - david


The -c flag will give you admin rights for a single command

su -c '/sbin/fdisk /dev/sdd'

sg