LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-05-2010, 08:53 AM   #1
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Rep: Reputation: 0
sudo issue


I've just installed Slackware64 13.1 on my PC and I have a problem with sudo command.
I have added myself to "wheel" group

Code:
wheel:x:10:root,zosty
and I have modified the /etc/sudoers file in order to allow to "wheel" members to run any command with root privileges....

Code:
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
# Failure to use 'visudo' may result in syntax or file permission errors
# that prevent sudo from running.
#
# 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

# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL

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

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

# Samples
%users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
%users  localhost=/sbin/shutdown -h now

but it doesn't work...
Where is my mistake?
Thanks!
Z
 
Old 06-05-2010, 09:11 AM   #2
thinknix
Member
 
Registered: Nov 2008
Distribution: Lots!
Posts: 178

Rep: Reputation: 58
If you run the 'groups' command as user zosty, do you see the wheel group listed in the output? If not, either log out/in again or start a subshell under the new group with 'newgrp wheel'. sudo should then work for you in either case.
 
Old 06-05-2010, 09:18 AM   #3
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Original Poster
Rep: Reputation: 0
This is the output to groups:

Quote:
zosty@Zosty:~$ groups
zosty wheel floppy audio video cdrom plugdev power scanner users
So...it should be correct but it still doesn't work.
 
Old 06-05-2010, 09:24 AM   #4
thinknix
Member
 
Registered: Nov 2008
Distribution: Lots!
Posts: 178

Rep: Reputation: 58
OK, that is odd...I'm assuming you used visudo to edit the sudoers file? What does the output of 'visudo -c' show you? You should see this:

Code:
root@nix0:~# visudo -c
/etc/sudoers: parsed OK
 
Old 06-05-2010, 09:29 AM   #5
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Original Poster
Rep: Reputation: 0
I confirm I used visudo to edit sudoers file.
This is the output:

Quote:
root@Zosty:/home/zosty# visudo -c
/etc/sudoers: parsed OK
 
Old 06-05-2010, 09:33 AM   #6
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
And, what is the output of
Code:
ls -la `which sudo`
Forrest
 
Old 06-05-2010, 09:38 AM   #7
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Original Poster
Rep: Reputation: 0
It seems correct...

Quote:
root@Zosty:/home/zosty# ls -la `which sudo`
-rws--x--x 1 root root 149088 Apr 20 14:19 /usr/bin/sudo

Z
 
Old 06-05-2010, 09:46 AM   #8
thinknix
Member
 
Registered: Nov 2008
Distribution: Lots!
Posts: 178

Rep: Reputation: 58
I'm curious what you see in your /var/log/syslog and on your console when you try to run any command under sudo. If I take myself out of the wheel group, I see this:

Code:
dmaxwell@nix0:~$ sudo ls -l /root/
Password:
dmaxwell is not in the sudoers file.  This incident will be reported.
dmaxwell@nix0:~$
...
Jun  5 10:42:49 nix0 sudo: dmaxwell : user NOT in sudoers ; TTY=pts/3 ; PWD=/home/dmaxwell ; USER=root ; COMMAND=/usr/bin/ls -l /root/
 
Old 06-05-2010, 09:56 AM   #9
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Original Poster
Rep: Reputation: 0
OK! I think I have to say sorry for the question...maybe I need to understand better how sudo works!

Anyway, this is the output:

Code:
sudo ls -l /root/
Password:
total 4
drwx------ 2 root root 4096 2010-06-02 20:16 Desktop
The problem is (for example...):

Code:
zosty@Zosty:~$ sudo visudo 
sudo: visudo: command not found
zosty@Zosty:~$ sudo halt
sudo: halt: command not found
So...I thougth was a sudo problem...but it is a Zosty's problem!
 
Old 06-05-2010, 10:00 AM   #10
thinknix
Member
 
Registered: Nov 2008
Distribution: Lots!
Posts: 178

Rep: Reputation: 58
Ah, OK, so sudo does work for you. This is just a path issue - just add /sbin, /usr/sbin and maybe /usr/local/sbin/ to your $PATH, or use the absolute paths, like this:

Code:
sudo /sbin/halt
 
Old 06-05-2010, 10:04 AM   #11
zosty
LQ Newbie
 
Registered: May 2010
Distribution: Slackware64 13.1
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks!!!
 
Old 06-05-2010, 01:23 PM   #12
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Personally I never use sudo and don't really like setting up sudoers. I find it much more convenient to run a command as root with :
Code:
su -c "command"
where command is what I want to run. Admittedly this needs the root password but as it's only me using this it's no problem. This also automatically sets up the paths for the superuser.
 
  


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
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Authentication Issue su/sudo/pam Debian AusFreak Linux - Newbie 3 03-22-2010 08:21 AM
sudo NOPASSWD issue lensem Linux - Software 5 11-25-2009 05:08 PM
sudo(/etc/sudoers) issue knockout_artist Linux - Newbie 2 03-24-2009 04:39 PM
Output issue with sudo and php system/shell_exec functions 5ury4 Linux - Server 1 05-25-2008 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:26 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