Search Perform an advanced search query SOFTPEDIA
 
SOFTPEDIA
Updated one minute ago
HomeSubmit a program for being reviewedAdvertise on our websiteGet help on surfing our websitesSend us your feedbackGet information about our XML/RSS backend and how to use itBrowse the news archiveVisit our discussion forumVizitati forumul in limba romana



KLIP
  1. HOME
  2. SCIENCE
  3. TECHNOLOGY
  4. WEBMASTER
  5. SECURITY
  6. MICROSOFT
  7. LINUX
  8. APPLE
  9. GAMES
  10. TELECOMS
  11. REVIEWS
  12. LIFE & STYLE
  13. EDITORIALS
  14. INTERVIEWS
  15. RSS
Welcome!
Hello, Guest

Login if you have a Softpedia.com account.

Otherwise, register for one.

OTHER TIPS, TRICKS AND TUTORIALS

Grant Root Privileges to Regular Users

- The proper way to allow certain regular users to run commands as root.

By: Mihai Marinof, Linux Editor

A multi-user system is a Linux computer which is used by other persons besides you. If you run such a multi-user system, you probably know that users sometimes need to run certain commands as root. Of course, you can't just give them the root password so wouldn't it be nice to allow particular users to run certain commands that require root privileges without having to tell them the root password? There's a well-known tool which will solve this problem, called sudo.

sudo (SUperuser DO) is a tool for Unix-like operating systems that allows normal users to run programs with the security privileges of the system's superuser in a secure manner. Users will have to confirm their identity to sudo by typing-in their password before running the target program. However, which users are allowed to use sudo, what commands are they allowed to execute, as well as other related settings can be configured through the /etc/sudoers file.

The /etc/sudoers content will differ from distribution to distribution
but the structure, however, will most likely be the same in all distributions. The default sudoers file will look like this:

CODE

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults

# User privilege specification
root ALL=(ALL) ALL



Allow a local user to run root commands

- Take for example the /sbin/shutdown command: by default, you won't be able to execute it unless you have root privileges. In order to allow a local user (I'll use softpedia as the example user) to shut down the computer, you'll have to define the alias which represents the shutdown command by adding this line in the Cmnd alias section:

CODE

# Cmnd alias specification
Cmnd_Alias SHUTDOWN = /sbin/shutdown


- Then, in the User privilege section, you'll have to add the line:

CODE

# User privilege specification
softpedia ALL = SHUTDOWN


- Now, the user softpedia will be able to shutdown the computer by using the command:
# sudo shutdown -h now

- The sudo program will prompt users for their own password (not the root's) before executing the command. If you wish to setup sudo for not prompting users for any password, edit the line in the User privilege section to look like this:

CODE

softpedia ALL = NOPASSWD: SHUTDOWN



Allow a local user to run root commands without sudo or su

NOTE: This will allow the specified user to run any command as root, without having to use su, sudo or constantly type in his or the root password.

- First, add the OWNER alias by adding the following lines in the User alias and User privilege sections of /etc/sudoers file:

CODE

# User alias specification
User_Alias OWNER = softpedia

# User privilege specification
OWNER ALL = NOPASSWD: ALL



Allow users that are part of certain groups to run root commands

- You can define a group of people who are allowed to perform certain administration commands which require root privileges. This can be achieved by adding the following lines in the User alias, Cmnd alias and User privilege sections:

CODE

# User alias specification
User_Alias ADMINS = softpedia,john,david

# Cmnd alias specification
Cmnd_Alias UPDATE = /usr/bin/yum
Cmnd_Alias REBOOT = /usr/bin/reboot

# User privilege specification

ADMINS ALL = UPDATE, REBOOT


- This example will allow the user softpedia, john and david to periodically update the system through yum and reboot it after the update is complete. Of course, you can define other commands and other users, but keep the same structure. All commands defined can be executed by those users without having the root password.
- The commands are fully logged via syslog.

MORE RELATED ARTICLES: Installing NTFS Write Support on Fedora/Ubuntu Setting Up a SHOUTcast Server DSP Plug-In Apache VirtualHosting Guide Building Your Own IRC Server with Services Resetting a Forgotten Root Password How to Setup a Free Backup Solution for MySQL How to Get Connected to the IPv6 Internet
 
Comments | Link here | Subscribe
Print | Send to friend
Today's News | Yesterday's News

Search:

5th December 2006, 09:07 GMT | Copyright (c) 2006 Softpedia | Contact:
Read by 10,861 user(s) | Rating: | 11 vote(s) so far | Cast your vote:
Grant Root Privileges to Regular Users - USER OPINIONS




We are sorry, there are no opinions available for this article.






SHARE YOUR OPINION ABOUT Grant Root Privileges to Regular Users

Since you are not logged on, your comments will have to be approved before being displayed.
Click here to login, or register.
Your Name:
Your Email:
Type in the result:
Your Opinion:
 


DO YOU WANT TO CONTACT US?  

If you have some comments or you want to send us some information you can send us an email directly to .
You can use the form below for the same purpose.
Your full name: (at least 3 characters)
Your email address: (at least 5 characters)
Message subject: (at least 5 characters)
Message text:
(at least 10 characters)
Type in the result:
 
 



© 2001 - 2008 Softpedia. All rights reserved.
Softpedia™ and Softpedia™ logo are registered trademarks of SoftNews NET SRL.
Copyright Information | Privacy Policy | Terms of Use | Contact Softpedia | Update your software | Archive