Ubuntu: Using Sudo to Grant User Privileges

Hi! If you're new here, you may want to subscribe to the Unix Tutorial RSS feed to get regular tips & tricks for all flavors of Unix. Thanks for visiting!

If you have used your fresh Ubuntu install for longer than half an hour, chances are that you've discovered the sudo command already.

sudo allows certain users to execute a command under another user's privileges. Most commonly, using sudo implies running a command as a superuser, but the approach works equally well for allowing you to inherit a user ID (uid) and group ID (gid) of any user on the system.

To gain access, a password is asked, and by default it is your password, and not the password of a user you're trying to run a command as. This allows for the system' s administrator to effectively manage user privileges without having any user share their password.

sudo is based off the /etc/sudoers file, which should be edited by root employing the visudo command. WARNING: although /etc/sudoers file is a regular text which root can edit manually, ONLY visudo way of updating it is recommended, as this command, apart from editing capabilities, also does a syntax check of the changes before applying them to prevent user privilege related disasters.

If you want to grant superuser privileges to a particular user, the following line should be added to the /etc/sudoers file (just type visudo to invoke the editor):

greys ALL=(ALL) ALL

In this example, greys is the username.

Please share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • BlinkList
  • Fark
  • Furl
  • kick.ie
  • Netscape
  • Reddit
  • StumbleUpon
  • Technorati
  • YahooMyWeb

1 comment so far ↓

#1 visudo tutorial | UNIX Tutorial: Learn UNIX on 12.13.07 at 4:55 am

[...] Grant User Privileges in Ubuntu Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

Leave a Comment