# sudo NOPASSED option not working

**URL:** https://forums.suse.com/t/sudo-nopassed-option-not-working/27106
**Category:** SLES Configure-Administer
**Created:** [June 3, 2015, 9:23pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106 "2015-06-03T21:23:03Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jgosney](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@jgosney](https://forums.suse.com/u/jgosney)
#### Post date: [June 3, 2015, 9:23pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/1 "2015-06-03T21:23:03Z")

</div>

Hi all,

On a new SLES11sp3 box, I’m trying to give one user the rights to sudo run the iptables command. I’ve modified the sudoers file with the following entry:

jsmith ALL = (root) NOPASSWD: /usr/sbin/iptables

Yet with the user runs ‘sudo iptables’, it is still prompting them for the root password.

What is wrong with my syntax?

jg

---

<div class="post-metadata">

### Author: ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)
#### Post date: [June 3, 2015, 9:41pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/2 "2015-06-03T21:41:29Z")

</div>

What are the other uncommented lines in there? Could something be  
preventing this one from being applicable?

What happens if they properly call the command with an absolute path  
rather than trying to find whatever is in the PATH? If they have an alias  
under ~/bin or /usr/local/bin or /usr/bin that is being found, the sudoers  
file is not authorizing access to those.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

### Author: ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)
#### Post date: [June 3, 2015, 10:04pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/3 "2015-06-03T22:04:20Z")

</div>

> [@](#):
>
> On Wed 03 Jun 2015 06:24:04 PM CDT, jgosney wrote:
> 
> Hi all,
> 
> On a new SLES11sp3 box, I’m trying to give one user the rights to sudo  
> run the iptables command. I’ve modified the sudoers file with the  
> following entry:
> 
> jsmith ALL = (root) NOPASSWD: /usr/sbin/iptables
> 
> Yet with the user runs ‘sudo iptables’, it is still prompting them for  
> the root password.
> 
> What is wrong with my syntax?
> 
> jg

Hi  
The (root) bit… and assuming your using visudo 😉

```auto
jsmith ALL = NOPASSWD: /usr/sbin/iptables
```

–  
Cheers Malcolm Â°Â¿Â° LFCS, SUSE Knowledge Partner (Linux Counter #276890)  
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.39-47-default  
If you find this post helpful and are logged into the web interface,  
please show your appreciation and click on the star below… Thanks!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/5/5012ba89e3ffb5220dac47d5ea0ba032e2fe1cb6.png) [@system](https://forums.suse.com/u/system)
#### Post date: [June 4, 2015, 1:56am UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/4 "2015-06-04T01:56:19Z")

</div>

On 06/03/2015 01:24 PM, jgosney wrote:[color=blue]

> Hi all,
> 
> On a new SLES11sp3 box, I’m trying to give one user the rights to sudo  
> run the iptables command. I’ve modified the sudoers file with the  
> following entry:
> 
> jsmith ALL = (root) NOPASSWD: /usr/sbin/iptables
> 
> Yet with the user runs ‘sudo iptables’, it is still prompting them for  
> the root password.
> 
> What is wrong with my syntax?[/color]

Try:

sudo /usr/sbin/iptables

---

<div class="post-metadata">

### Author: ![jgosney](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@jgosney](https://forums.suse.com/u/jgosney)
#### Post date: [June 4, 2015, 5:10pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/5 "2015-06-04T17:10:05Z")

</div>

We’ve discovered that the user can simply run /usr/sbin/iptables and access command. Checking the command, the rights on it is 777. Does this seem right? This seems like a very powerful command for everyone to be able to access it if they know the explicit path to it.

---

<div class="post-metadata">

### Author: ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)
#### Post date: [June 4, 2015, 5:27pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/6 "2015-06-04T17:27:48Z")

</div>

You’re ignoring the first part of that file’s ‘ls -l’ output which  
indicates that it is a symlink, and symlinks always have 777 set (you  
cannot change it):

```auto
lrwxrwxrwx 1 root root 14 May 1 2014 /usr/sbin/iptables -> iptables-multi
```

Further, explicit rights to run a file does not imply that the user has  
rights to do anything power when using that file. Sure, you can run it as  
any user, and no it doesn’t do anything unless you actually have  
privileges (via sudo or other). The actual file looks like this:

```auto
-rwxr-xr-x 1 root root 57592 Jan 13 2012 /usr/sbin/iptables-multi
```

Real binaries like this should never be world-writable, but even if they  
were that would not let somebody do bad things unless they could both  
modify the file AND somehow run it with privileges… Having both barriers  
is always smart.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

### Author: ![jgosney](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@jgosney](https://forums.suse.com/u/jgosney)
#### Post date: [June 4, 2015, 5:48pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/7 "2015-06-04T17:48:06Z")

</div>

Great explanation Ab! I did notice the link and that the rights on iptables-multi was 744. I assumed since the ‘x’ bit was set, they could run the command and thus do anything the command would normally allow. So your explanation is reassuring. But I’m still back to the NOPASSWD part not working. I’ve tried all the suggestions given above and nothing seems to work. Obviously, I don’t want to give JSMITH the root password (that would invalidate the entire SUDO concept) so I’m kinda stuck as to why this option is not working correctly. I’ve also opened an SR with Novell and am waiting to see if they can give me any advice.

---

<div class="post-metadata">

### Author: ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)
#### Post date: [June 4, 2015, 6:35pm UTC](https://forums.suse.com/t/sudo-nopassed-option-not-working/27106/8 "2015-06-04T18:35:04Z")

</div>

The following worked for me on my SLES 11 SP3 system:

```auto
ab ALL = (root) NOPASSWD: /usr/sbin/iptables
```

Is your user’s username EXACTLY ‘jsmith’ (vs. something with silly capital  
letters like ‘Jsmith’ or ‘JSMITH’)? Are there any other characters on the  
relevant lines? Care to post the entire file’s contents?

```auto
grep -v -e '^$' -e '^#' /etc/sudoers
```

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…
