0

i want to allow the use of /usr/sbin/ufw for a special user.

But only for a given command:

in my /etc/sudoers file i have now (for blocking IPv4 addresses):

blockuser   ALL=NOPASSWD: /usr/sbin/ufw deny from [0-9\.]* to any

But when i try to execute the command i get an:

/etc/sudoers: syntax error near line 27

error (which is the line i posted before).

So my question, is it possible to work with such a placeholders in sudo?

  • Seems: /usr/sbin/ufw deny from [0-9]*[0-9]*[0-9]*[0-9]* to any is working – user4013391 Dec 18 '14 at 14:31
1

sudo is not using regular expression, it is using standard shell glob patterns.

So for blocking an IPv4 address you must use:

blockuser   ALL=NOPASSWD:/usr/sbin/ufw deny from [0-9]*[0-9]*[0-9]*[0-9]* to any

\. is not allowed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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