sudo for only ufw?

2

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?

John

Posted 2013-03-19T15:30:51.457

Reputation: 673

do NOT directly edit /etc/sudoers.....use the visudo command! – mdpc – 2013-03-19T15:43:48.583

oops i just did it and it's working right now. DO i need to go back and revert my changes? – John – 2013-03-19T15:44:43.160

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 – 2013-03-19T15:45:38.830

Answers

2

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.

Flup

Posted 2013-03-19T15:30:51.457

Reputation: 3 151