Using sudo in Linux


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 focus on the easiest way a user can use the administrative privileges assigned to him/her by the sudoers file, whithout knowing the root passord.



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.

Top                                                                                                                                                                      Back
Last Update: Thursday, June 24, 2003 | © 2002-2003 Kay Nix  ·  K-SeCuRiTy Timisoara, Romania