LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Sudo Problem (https://www.linuxquestions.org/questions/linux-general-1/sudo-problem-507766/)

Mithic 12-05-2006 06:52 PM

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?

matthewg42 12-05-2006 07:00 PM

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

Mithic 12-05-2006 07:14 PM

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
$


matthewg42 12-05-2006 07:34 PM

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.

Mithic 12-05-2006 07:46 PM

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.

matthewg42 12-05-2006 07:54 PM

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.

Mithic 12-05-2006 08:00 PM

Quote:

Originally Posted by matthewg42
And it works as root? On this machine? In the same installation of debain?

I'm running Slackware 11.

zetabill 12-05-2006 08:09 PM

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.

Mithic 12-05-2006 08:21 PM

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.

matthewg42 12-05-2006 09:43 PM

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. :)

sn68 12-05-2006 10:30 PM

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

matthewg42 12-05-2006 10:47 PM

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.

sn68 12-05-2006 10:57 PM

Amended (thanks matthewg42)

Add following line to .bashrc
PATH = $PATH:/sbin
export PATH

matthewg42 12-05-2006 11:09 PM

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=..."?

Mithic 12-05-2006 11:14 PM

It says .bashrc doesnt exist.


All times are GMT -5. The time now is 03:14 AM.