-   Slackware (
-   -   sudo permission denied (

Swift&Smart 07-08-2006 05:14 AM

sudo permission denied

Yesterday,I used sudo to do some administrative task as root.However,if I issue command "sudo -u user command",the computer told me that permission denied.And it's strange that when I issue this command without specifying user(I log in as that user),the command will go fine. :scratch:

Do you guys have any experience of that one?Please guide.

uselpa 07-08-2006 09:41 AM

Can you post the output of

cat /etc/sudoers | grep -v "^[:space:]*#" | grep -v "^[:space:]*$"

Swift&Smart 07-12-2006 12:17 PM

my terminal responsed with these code:


nobody localhost=(ALL) NOPASSWD:command_which_i_need_to_run
Any clue?

unSpawn 07-12-2006 01:34 PM

Try using an unprivileged account with UID >= 500 (/etc/login.defs default):

swiftsmart localhost=(ALL) NOPASSWD: (nobody) command_to_run
Now if you do "sudo -l" as user "swiftsmart" you'll see you can "sudo -u nobody command_to_run".
Of course "nobody command_to_run" must be accessable as user nobody and maybe need cd /somewhere/else if it isn't allowed to output in the CWD.

Swift&Smart 07-13-2006 12:11 AM

unSpawn,I need to clarify something.

Please correct me if I am wrong.SUDO is used to do some task which only root can do but use other account than root because of security concern.Is that right?If so,why can't user "nobody" uses command which root can run?How come the command should be accessible by nobody.Isn't it nobody is a substitute as root?

Please tell.:)

uselpa 07-13-2006 02:05 AM

sudo can be configured to allow you to run commands as ANY OTHER user. root is just the most obvious use case, but you can also permit user U1 to run command C1 as user U2, where U2 can be root or nobody or whatever you like.

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