1847704 Members
4320 Online
110265 Solutions
New Discussion

sudo

 
Cheung_2
Frequent Advisor

sudo

I would like to let the user "edp_usr" to run "ll"
as root, I have add the below line to file /etc/sudoers
" edp_usr gzip=/bin/ll" ,

then the user "edp_usr" try to run the below statement, the system ask to input the password, can suggest what is wrong in my setting? thx.
#whoami
edp_usr
# sudo ll /tmp
Password:
Andy
9 REPLIES 9
nibble
Super Advisor

Re: sudo

clarification, what is "ll"? is that the "ls -l" command?
Jerome Baron
Respected Contributor

Re: sudo

Hi,

You have not insert the nopasswd option
edp_usr gzip=NOPASSWD:/bin/ll

http://www.courtesan.com/sudo/man/sudoers.html#nopasswd%20and%20passwd

Regards,
Jerome
Ravi_8
Honored Contributor

Re: sudo

Hi,

By default, sudo requires that a user authenticate him or herself before running a command. This can be modified via the NOPASSWD tag.
edp_usr = NOPASSWD /bin/ll
would allow the user edp_usr to run /bin/ll as root without authenticating himself.
never give up
Rainer von Bongartz
Honored Contributor

Re: sudo

The behaviour is totally correct !!


sudo requires that a user has to enter his password before he can run the defined commands

You can change this with the NOPASSWD option.

Regards
Rainer

He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Jochen Heuer
Respected Contributor

Re: sudo

Hi Cheung,

give some points to correct answers:

This member has assigned points to 98 of 175 responses to his/her questions.
Well, yeah ... I suppose there's no point in getting greedy, is there?
Cheung_2
Frequent Advisor

Re: sudo

thx all reply, but it still ask password after add the word "NOPASSWD" ,
my statement is /etc/sudoers is "edp_usr ll = NOPASSWD: /bin/ll" , then the user "edp_usr" run "sudo ll /tmp" , it still ask password, can suggest what is wrong? thx.
Andy
Jerome Baron
Respected Contributor

Re: sudo

have you not an alias to your profile (alias ll=ls -l)
try sudo /bin/ll

Jerome
Scott Corzine
Advisor

Re: sudo

You should use:

edp_usr ALL = NOPASSWD: /bin/ll

If you want edp_usr to be able to use this without specifying the user's passwd on any host this is installed on. If you want to restrict it to a specific host, replace the "ALL" above with your hostname as returned by `hostname` (see the man page for some more details).

Both of your examples:

edp_usr gzip=/bin/ll

edp_usr ll=NOPASSWD:/bin/ll

Have the same mistake, by putting a command name BEFORE the "=" you've stated that these permissions are only valid on the hosts named "gzip" and "ll" respectively.

The command "sudo -l" may be helpfull in checking complex configurations.


Hope this helps,
-Scott-
Matthew Ghofrani
Regular Advisor

Re: sudo

Try using this format:

edg_usr ALL=(root) NOPASSWD:/bin/ll , /bin/another_command , and so on

Matthew From Boston
Life is full of bugs