Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have set the following line in the /etc/sudoers file

sana ALL=NOPASSWD: /usr/bin/wine

As the user sana, when I execute the command in the shell sudo -u randeel /usr/bin/wine cmd /c wscript some.vbs, it prompts for a password.

What is wrong here? I don't want a password prompt when I execute the command.

share|improve this question
    
are you a root user? –  Sudantha Nov 24 '10 at 13:12
    
i have root access. but not for the account sana –  randeel wimalagunarathne Nov 24 '10 at 13:16
add comment

migrated from stackoverflow.com Nov 24 '10 at 13:17

This question came from our site for professional and enthusiast programmers.

3 Answers

sudo means "super user do", meaning "perform this command as the super (root) user". If you are not logged on as the root user of your system, using sudo will ask you for your password, and check that you are in the sudoers file. If both of these checks succeed then you are allowed to execute the command as the root user.

Adding yourself to the sudoers file does not prevent you from having to enter a password to use sudo, it enables you to use sudo in the way you are experiencing.

share|improve this answer
    
Ah yes, this answer probably does belong on SU. –  Marcus Whybrow Nov 24 '10 at 13:15
1  
You can use the NOPASSWD: option to eliminate the password requirement. –  hbdgaf Nov 24 '10 at 13:36
    
and it doesn't stand for super user do, it stands for switch user do...you don't have to be switching to super user –  hbdgaf Nov 24 '10 at 13:47
    
I think technically is stands for "Substitute User DO" the default substitue user being the super user. –  Marcus Whybrow Nov 24 '10 at 14:22
add comment

Have you attempted to run /usr/bin/wine as yourself via sudo? What is the outcome?

There is nothing syntactically wrong with your sudo configuration, however, using the -u flag may be interfering with your intended behavior.

If you always wish to execute wine as user randeel rather than the effective sana user you may want to investigate the runas_spec for sudoers. For example:

sana ALL=(randeel) NOPASSWD: /usr/bin/wine

share|improve this answer
    
nice catch on the -u borking it. this is a good idea as well. if it doesn't fix it also try the single quoting –  hbdgaf Nov 24 '10 at 13:46
add comment

I think sudo is having trouble with the command-line args. Try single quoting the entire /usr...vbs area and adding that entire command as your command alias in sudoers(also single quoted)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.