LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   sudo rights (https://www.linuxquestions.org/questions/linux-general-1/sudo-rights-4175486556/)

wtb 12-02-2013 09:59 AM

sudo rights
 
Hello,


I have some problems to give rights to a user, and I don't find why.

The script :
Quote:

rwxrwxrwx 1 deploy web 1684 Dec 2 15:31 wdeploy.sh
I want to execute it as another user called "admweb" like this :

Quote:

deploy$ sudo -u admweb /local/deploy/wdeploy.sh
And have this message :

Quote:

[sudo] password for deploy:
Sorry, user deploy is not allowed to execute '/local/deploy/wdeploy.sh' as admweb on my_server.
And I don't know why :(

This is my sudoers :

Quote:

deploy my_server = (admweb) NOPASSWD: /local/deploy/wdeploy.sh
And user admweb is in group of deploy in the /etc/group.


Can you help me on this?

Thanks

pingu 12-02-2013 01:46 PM

Group names in /etc/sudoers needs prefix '%'. Without % the name ("deploy") is taken as a single user name.

wtb 12-03-2013 10:05 AM

deploy is a single user.

pingu 12-03-2013 11:03 AM

I might have read a bit hastily, I see now maybe it's not a sudo issue. (You wrote "user admweb is in group of deploy", I read that as you meant it would grant admweb sudo rights.)
What are the permissions on the file /local/deploy/wdeploy.sh and the directories above?

wtb 12-06-2013 11:47 AM

I gave all the permissions (777) to do my test, on the directory and on the script...

I don't know why it is not working :(

pingu 12-06-2013 12:47 PM

There's something fishy here!
I recreated it in my system - same users, same file-to-be-executed, same line in /etc/sudoers - it works fine.

What distro are you running?
Do you have selinux, if so permissive or enforcing? ("sestatus" will tell.)
What's in the script, can you post it?
Is the directory mounted without execute permissions? Post your /etc/fstab.
All I can think of for now.

pingu 12-06-2013 12:50 PM

Wrong hostname!?
What's the output of command "hostname" - compare it with your "my_server" is it the same?


All times are GMT -5. The time now is 01:34 PM.