Sudo access issue


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Sudo access issue
# 1  
Old 05-08-2014
Sudo access issue

Hi,

I have given access to user mwadmin in shudders file as :
Code:
mwadmin  ALL:NOPASSWD:/www/* /usr/* /opt/*

However, not able to execute below command:
Code:
sudo mkdir -p /usr/test
[sudo] password for mwadmin:
Sorry, user mwadmin is not allowed to execute '/bin/mkdir -p /usr/test' as root.

Please help.

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 05-08-2014 at 11:45 AM..
# 2  
Old 05-08-2014
You should carefully study the sudoers manual. There are multiple fundamental errors in that entry.

Regards,
Alister
# 3  
Old 05-08-2014
OK, let me simplify the requirement,
We need a user to have all permissions under /usr Dir which is owned by root.
Please help.
# 4  
Old 05-08-2014
So are you happy for your user to issue sudo /usr/bin/passwd root?

There is the option there for someone to create something in any of those directories and then execute it as root, so if they can copy /sbin/shutdown to /www/private/application/area/my_shutdown and execute it there..... or the same with rm

Of course there is nothing really to stop them creating a script that simply calls a shell or su. Calling that with sudo would effectively log them on.


Blanket access is just asking for trouble. It may seem like a lot of effort, but your are best to find out what is actually needed. Why do you want to just give open access anyway?

Besides, if you need to allow execute of mkdir, it's best to have a rule that allows it rather than something wildly dangerous that doesn't actually do what you want.



Robin
# 5  
Old 05-08-2014
Quote:
Originally Posted by saurau
Hi,

I have given access to user mwadmin in shudders file as :

mwadmin ALL:NOPASSWD:/www/* /usr/* /opt/*

However, not able to execute below command:

sudo mkdir -p /usr/test
[sudo] password for mwadmin:
Sorry, user mwadmin is not allowed to execute '/bin/mkdir -p /usr/test' as root.

Quote:
Originally Posted by saurau
We need a user to have all permissions under /usr Dir which is owned by root.
Even if you set that up correctly, on your system, according to the diagnostic message, mkdir isn't under the /usr hierarchy.

More importantly, as I said, there are multiple errors in your attempt at a sudoers entry.

Did you edit sudoers using visudo? I suspect not, because it would have detected a syntax error (it should be an equals sign after the host specification, not a colon).

Aside from that, there are other non-syntactic, logical errors. Command specifications are comma-delimited. Your command specification will be treated as one long spec, not three. Only files in /www/ will match and the other two patterns are used to restrict the command's arguments.

Even if you delimited the command specifications correctly, the wildcards would not behave as you expect. As with shell pattern matching (aka globbing), the * will not match /. This means that /usr/* only matches files in /usr. It will match /usr/bin/, the directory itself, but not any of the executables of interest in /usr/bin and /usr/sbin.

Wildcards are unnecessary to match all files in a directory. The command specification can list a directory directly and that will be interpreted as matching any executable within it.

You really should spend an evening with the sudo, sudoers, and visudo documentation and inform yourself.

Regards,
Alister
This User Gave Thanks to alister For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using plink with sudo access

I have similar issue as mentioned in 167174-how-run-script-using-batch-file.html It works good, but the control is not coming back to source i tried adding exit to remote script. Thanks, Suresh (0 Replies)
Discussion started by: snsuresh
0 Replies

2. UNIX for Dummies Questions & Answers

Inheriting SUDO access?

I had a question on users inheriting SUDO capabilities of another account. Let's say that there are three users A, B, and C. A has access to Sudo into B. B has access to Sudo into C. Does this give A access to sudo into B and then sudo into C. A -> B B -> C A -> B -> C ? Another example. My... (2 Replies)
Discussion started by: sbcopty
2 Replies

3. Solaris

Sudo access in Solaris

Install the sudo pkg SFWsudo.tar bash#tar -xvf SFWsudo.tar bash#pkgadd -d . SFWsudo path may be /opt/sfw/bin Make entry the user name in sudoer file path of the sudoer file /opt/sfw/etc/sudoers check with the below command as a user (not as a root user) user1$... (1 Reply)
Discussion started by: Narendiran
1 Replies

4. UNIX for Advanced & Expert Users

Help needed in sudo access

I want to give root access to a user called denielr on server - tsprd01, but do not want to share root password. I have sudoers configured already. He should have all access equal to root. I made this entry in /etc/sudoers, but it is not working denielr tsprd01 =(root) NOPASSWD: ALL I tried to... (2 Replies)
Discussion started by: solaris_1977
2 Replies

5. Ubuntu

Restrict SUDO Access

Linux ubuntu 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux Hi Folks, Please help me. I am bit struck here. Here is the OS info. Linux ubuntu 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux I have a... (17 Replies)
Discussion started by: explorer007
17 Replies

6. UNIX for Dummies Questions & Answers

sudo/root access

I'm actually working with a Ubuntu-System here and have a question about executing a command with 'sudo'. I tried and got a error message like "not allowed". After this I logged in with 'sudo -s' and typed the command without 'sudo'. This worked well. Can please somebody explain me this... (0 Replies)
Discussion started by: daWonderer
0 Replies

7. Shell Programming and Scripting

ONLY SU Sudo access

Hello All, I want to create a script that will do ONLY su to any user on the server with hpadmin login using sudo. Can anyone let me know how can it do it. Regards Ankit (1 Reply)
Discussion started by: ajaincv
1 Replies

8. AIX

sudo user access

I have installed sudo on AIX 6100-04 and want to know how do I set it up for a user to be able to run only some commands? I want to give the user the rights to only cd to certain directories and run the ls command to name a few? Are there any issues with running sudo when the user is forced to... (2 Replies)
Discussion started by: daveisme
2 Replies

9. Linux

sudo access verification

Hi All, I got lots of request with sudo, a manager request, verbal command, do this and do that. The problem with this kind of request is when I added that script and that. It will not be perfect, it's because I can't verify the userid sudo access, I can't reset their password as well, I... (2 Replies)
Discussion started by: itik
2 Replies

10. Solaris

secure access using sudo

I just need to know what should be done on a login user so that no one can access it except through sudo i.e. telnet server login: user NO ACCESS telnet server login: mylogin sudo - user <any command> ACCESS GRANTED thanks (0 Replies)
Discussion started by: melanie_pfefer
0 Replies
Login or Register to Ask a Question