Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to allow the johnuser sudo access for just the ufw command. Is this the appropriate statement to write into /etc/sudoers ?

johnuser    ALL=(ALL) /bin/ufw

I'd try this right away only I don't have access to the server. I'm instructing someone else how to do it via email. One thing hte other person said is that /bin/ufw doesn't exist. If that's the case, will that be a problem? Or how do you determine where ufw is?

share|improve this question
    
do NOT directly edit /etc/sudoers.....use the visudo command! – mdpc Mar 19 '13 at 15:43
    
oops i just did it and it's working right now. DO i need to go back and revert my changes? – John Mar 19 '13 at 15:44
    
if it works no problem....if it doesn't then do it. visudo does syntax checking and prevents you from having a broken /etc/sudoers file. – mdpc Mar 19 '13 at 15:45
up vote 1 down vote accepted

On my Ubuntu system ufw is in /usr/sbin, so your sudoers line should look like

johnuser    ALL=(root) /usr/sbin/ufw

If you know that ufw is on the system but you don't know where it is, then do

# which ufw

as root.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .