Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Last edited by SwannAnderson; 10-01-2005 at 03:37 PM.
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
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.
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.