LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-01-2005, 03:35 PM   #1
SwannAnderson
LQ Newbie
 
Registered: Sep 2005
Location: Lambare,Paraguay
Posts: 6

Rep: Reputation: 0
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

Last edited by SwannAnderson; 10-01-2005 at 03:37 PM.
 
Old 10-01-2005, 03:44 PM   #2
SwannAnderson
LQ Newbie
 
Registered: Sep 2005
Location: Lambare,Paraguay
Posts: 6

Original Poster
Rep: Reputation: 0
s
 
Old 10-01-2005, 03:56 PM   #3
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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?
 
Old 10-02-2005, 12:02 AM   #4
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
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.
 
Old 10-02-2005, 02:14 AM   #5
arlen
LQ Newbie
 
Registered: Dec 2004
Location: Melbourne, Australia
Posts: 2

Rep: Reputation: 0
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!
 
Old 10-03-2005, 07:10 PM   #6
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
sudo problem drigz Linux - Software 4 06-21-2004 03:46 PM
Problem with sudo punx120 Linux - Software 0 05-08-2004 10:43 AM
Sudo starting problem satimis Linux - Software 1 10-26-2003 05:37 PM
sudo - problem with cmnd_alias slackware stu Linux - Software 0 10-04-2003 12:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration