LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with sudo (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-sudo-368807/)

SwannAnderson 10-01-2005 03:35 PM

Problem with sudo
 
I wanna use sudo, to give alumno03 and grupo soparcial permission to use groupadd and useradd. I edit sudoers like this :
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification

# User privilege specification
root ALL=(ALL) ALL
alumno03 ALL=/usr/sbin/groupadd

# Uncomment to allow people in group wheel to run all commands
%laboratorios ALL=(ALL) ALL

# Same thing without a password
# %laboratorios ALL=(ALL) NOPASSWD: ALL

# Samples
#%laboratorios ALL=/usr/sbin/useradd,/usr/sbin/groupadd,/usr/sbin/passwd
# %users localhost=/sbin/shutdown -h now

BUT when I use alumno03 --> alumno03# sudo groupadd group1
I got this message --> Can not lock /etc/group

What is wrong here
Thanks

SwannAnderson 10-01-2005 03:44 PM

s

PTrenholme 10-01-2005 03:56 PM

Re: Problem with sudo
 
Quote:

Originally posted by SwannAnderson
I wanna use sudo, to give alumno03 and grupo soparcial permission to use groupadd and useradd. I edit sudoers like this :
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
[snip]
[/snip]What is wrong here
Thanks
Did you use the visudo command to edit the file?

cs-cam 10-02-2005 12:02 AM

I'm just going to jump is and say that it doesn't. I don't like the feel of vi at all and I've edited /etc/sudoers and made successful changes plenty of times with nano.

arlen 10-02-2005 02:14 AM

Ooh, such a bad idea.

Read carefully: This file MUST be edited with the 'visudo' command as root.

If you don't like vi, it's quite simple - change the environment variable EDITOR: under bash, you can type "declare EDITOR=nano", or whatever you like, then go ahead and use visudo!

tkedwards 10-03-2005 07:10 PM

From man visudo:
Quote:

visudo locks the sudoers file against multiple simultaneous edits, pro-
vides basic sanity checks, and checks for parse errors
There's nothing wrong with editing it with vi or any other text editor without visudo, as long as no one else edits it at the same time and you get the right syntax, essentially the same problems you have to aware of when editing any other config file.

Here's an example of how to give a user root access to run only a particular command using sudo:
Code:

alumno03  ALL=(ALL) NOPASSWD: /usr/sbin/groupadd
Note you can replace the NOPASSWD with ALL if you still want them to have to enter their password when they sudo.


All times are GMT -5. The time now is 04:15 AM.