LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Editing the sudoers file (https://www.linuxquestions.org/questions/linux-newbie-8/editing-the-sudoers-file-709696/)

Nagglfar 03-06-2009 02:30 PM

Editing the sudoers file
 
I know I need to use visudo to modify the sudoers file. However, I want to make commands for sudo as root.

I wanted to use the command userdel. How do I go about managing this?

jschiwal 03-06-2009 02:53 PM

Are you the only sudo user on your system. If so, then simply make yourself a member of the wheel group and then uncomment the line in visudo top allow members of wheel to use sudo. You can run any command then as root.

If there are other admin users and you want to restrict the commands that can be run, there is a sample cdrom mounting example you can modify to allow using the userdel command.

Code:

# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
You could substitute your username or a group for users in the example and change the command run. Be sure you use the full path to the command. The example given has two comma separated commands.

There is one gotha to be aware of. You sometimes need to log out after modifying sudo or especially if you add yourself to a group. Group membership is read when you start a new session.

Nagglfar 03-06-2009 11:53 PM

I have many users on the system. I need to configure sudo commands as root for only one specific user. Would the syntax look something like this?

*for instance assume the user is bob and i want to use the ifconfig command:

bob ALL=(ALL) ALL
ifconfig=/sbin/ifconfig

syg00 03-07-2009 12:02 AM

Try "man sudoers" - plenty of doco in there.

jschiwal 03-09-2009 07:16 AM

Generally, you just need to add users authorized to use sudo to the `wheel' group and then uncomment the line that let's members of the wheel group use sudo.


All times are GMT -5. The time now is 06:47 PM.