Using sudo in Linux: a mini tutorial

How can users have root (administrative) privileges in Linux, Unix without knowing the root password? One of the best answers to this question is sudo. Users login using their username and password and issue administrative commands placing sudo in front of the commands, e.g. sudo rpm -Uvh *.rpm , to run the command which installs and updates programs in Linux (rpm). For more details see this introduction to sudo from its authors. To create the file which assign administrative privileges to users -- the sudoers file, please read the sudoers documentation page.

This mini-tutorial focuses on the easiest way a user can use the administrative privileges assigned to him/her by the sudoers file, without knowing the root password.



Open a shell window
  1. at the bash shell prompt $ type sudo -v
  2. Linux will ask you for a password -- enter the password of your account
  3. For the next 5 minutes it will not ask you for your password when you use sudo.
  4. after Linux returns the bash shell prompt $ type sudo su -

  5. Since you already have root privileges, it will not ask you for the root password
  6. Linux will reply with something like [root@mislab01x root]#
    Linux accepts your login as root and gives you the root path.
  7. You can now enter any commands which require root privileges, without using sudo in front of the commands.

This page is maintained by Al Bento who can be reached at abento@ubalt.edu This page was last updated on February 3, 2003. Although we will attempt to keep this information accurate, we can not guarantee the accuracy of the information provided.