LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-05-2006, 06:52 PM   #1
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Rep: Reputation: 15
Sudo Problem


I uncommented
Code:
 %wheel	ALL=(ALL)	ALL
in the sudoers file and added my user to the "wheel" group and when i try
Code:
sudo dhcpcd eth1
it says
Code:
sudo: /etc/sudoers is mode 0644, should be 0440
What should i do to fix that?
 
Old 12-05-2006, 07:00 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
How did you edit the file? The proper way is with the visudo command. Editing this file manually is not a good idea. If you don't like the editor which visudo uses, you can set the EDITOR environment variable. For example, if it uses vi, and you like nano, you might enter this command (as root):
Code:
# EDITOR=nano visudo
You can fix the sudoers file permissions like this:
Code:
# chmod 440 /etc/sudoers
 
Old 12-05-2006, 07:14 PM   #3
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by matthewg42
How did you edit the file?
I logged in as root and edited it with kwrite.
I tried what you said,
Code:
# chmod 440 /etc/sudoers
and when i try to do a command (i.e)
Code:
$ sudo "modprobe psmouse"
sudo: modprobe psmouse: command not found
$
 
Old 12-05-2006, 07:34 PM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by Mithic
I logged in as root and edited it with kwrite.
I tried what you said,
Code:
# chmod 440 /etc/sudoers
and when i try to do a command (i.e)
Code:
$ sudo "modprobe psmouse"
sudo: modprobe psmouse: command not found
$
Now sudo appears to be functioning correctly, but your modprobe command is failing. To verify sudo's success, sudo a command which should surely succeed:
Code:
sudo echo hello world ; echo $?
If you see 0 after the hello world, sudo if fixed.

As for the psmouse module, my debian install has this built into the kernel - it is not a loadable module. You can check if this is the case with your installation with this command:
Code:
grep PSMOUSE /boot/config*
If you see "CONFIG_PSMOUSE=y", PSMOUSE is built into the kernel, not a module.
 
Old 12-05-2006, 07:46 PM   #5
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by matthewg42
To verify sudo's success, sudo a command which should surely succeed:
Code:
sudo echo hello world ; echo $?
If you see 0 after the hello world, sudo if fixed.
I tried that and it worked.

Quote:
As for the psmouse module, my debian install has this built into the kernel - it is not a loadable module. You can check if this is the case with your installation with this command:
Code:
grep PSMOUSE /boot/config*
If you see "CONFIG_PSMOUSE=y", PSMOUSE is built into the kernel, not a module.
The "CONFIG_PSMOUSE=y" came up, when i did that.

I run "modprobe psmouse" all the time as root so that my touchpad works and it does work as root.
 
Old 12-05-2006, 07:54 PM   #6
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by Mithic
I run "modprobe psmouse" all the time as root so that my touchpad works and it does work as root.
And it works as root? On this machine? In the same installation of debain? In my debian installation typing modprobe psmouse as root gives the same error message as you see when you run it with sudo. I can think of no reason why it would work as root, but not with sudo.

Last edited by matthewg42; 12-05-2006 at 07:56 PM.
 
Old 12-05-2006, 08:00 PM   #7
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by matthewg42
And it works as root? On this machine? In the same installation of debain?
I'm running Slackware 11.
 
Old 12-05-2006, 08:09 PM   #8
zetabill
Member
 
Registered: Oct 2005
Location: Rhode Island, USA
Distribution: Slackware, Xubuntu
Posts: 348

Rep: Reputation: 32
Try:
Code:
sudo /sbin/modprobe psmouse
Sudo works in the user's environment by default, so if /sbin isn't in your user's $PATH then sudo won't be able to find it even though it's executing the program with root priviledges. I've run into this problem before and this should hopefully be your fix.
 
Old 12-05-2006, 08:21 PM   #9
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by zetabill
Try:
Code:
sudo /sbin/modprobe psmouse
Sudo works in the user's environment by default, so if /sbin isn't in your user's $PATH then sudo won't be able to find it even though it's executing the program with root priviledges. I've run into this problem before and this should hopefully be your fix.
That worked, now my question is how do i add /sbin to my $PATH?
I'm pretty new to slackware and still dont know what that is exactly.
And thanks alot for the help, both of you.
 
Old 12-05-2006, 09:43 PM   #10
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by Mithic
I'm running Slackware 11.
I beg your pardon. I think I must have been cross posting in my mind Too many threads, too few braincells.
 
Old 12-05-2006, 10:30 PM   #11
sn68
Member
 
Registered: Oct 2005
Distribution: FC5
Posts: 338

Rep: Reputation: 30
Quote:
Originally Posted by Mithic
That worked, now my question is how do i add /sbin to my $PATH?
I'm pretty new to slackware and still dont know what that is exactly.
And thanks alot for the help, both of you.
Add following line to .bashrc
PATH = $PATH:/sbin

to edit .bashrc open terminal in home directory
>gedit .bashrc
 
Old 12-05-2006, 10:47 PM   #12
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
It should be
Code:
export PATH="$PATH:/sbin:/usr/sbin"
Note that you should not have any relative paths in your path, the most commonly found one is "." - the current working directory. This is security risk - if some program creates a file which has the same name as a utility which is often run as root in the current directory, you don't want a risk to run it accidentally. Now you are doing admin stuff from this user, you should check your PATH is safe.
 
Old 12-05-2006, 10:57 PM   #13
sn68
Member
 
Registered: Oct 2005
Distribution: FC5
Posts: 338

Rep: Reputation: 30
Amended (thanks matthewg42)

Add following line to .bashrc
PATH = $PATH:/sbin
export PATH
 
Old 12-05-2006, 11:09 PM   #14
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by sn68
Amended (thanks matthewg42)

Add following line to .bashrc
PATH = $PATH:/sbin
export PATH
This is something I've seen many times - setting PATH first, then exporting it. Is there some advantage to doing this over having it all in one command, "export PATH=..."?
 
Old 12-05-2006, 11:14 PM   #15
Mithic
Member
 
Registered: Nov 2006
Location: Downers Grove, Illinois
Distribution: Slackware 11, Kernel 2.6.18
Posts: 42

Original Poster
Rep: Reputation: 15
It says .bashrc doesnt exist.
 
  


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 On
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 humbletech99 Linux - Security 6 02-09-2006 11:01 AM
Problem with sudo SwannAnderson Linux - Newbie 5 10-03-2005 07:10 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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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