1827295 Members
3865 Online
109717 Solutions
New Discussion

sudoers and using #uid

 
Unix Administrator_5
Frequent Advisor

sudoers and using #uid

I have tried to get sudo to use uids instead of usernames.

I cant use the login names as they in uppercase.

However when I try to use the syntax

User_Alias MYTEST = #5000
it will not work.

However User_Alias MYTEST = abcd
does work.

It gives me syntax errors when I try #5000

Any Suggestions?
3 REPLIES 3
Steven Sim Kok Leong
Honored Contributor

Re: sudoers and using #uid

Hi,

According to the sudoers man page at http://www.courtesan.com/sudo/man/sudoers.html#aliases,

"A User_List is made up of one or more usernames, uids (prefixed with '#'), System groups (prefixed with '%'), netgroups (prefixed with '+') and other aliases."

However, also on the same man page,

User_List
User ::= '!'* username |
'!'* '%'group |
'!'* '+'netgroup |
'!'* User_Alias

'#'uid is not found in the expression. This is contradictory to the definition of a User_List above.

Following that, it is stated for the definition of the Runas_Alias that

"A Runas_List is similar to a User_List except that it can also contain uids (prefixed with '#') and instead of User_Aliases it can contain Runas_Aliases."

This would imply that the User_List in fact does not support '#'uid. Thus, I believe there is a typo on the man page with regards to the User_List definition, but that the User_List expression given is correct.

As such, try using Runas_Alias instead i.e.

Run_Alias MYTEST = #5000

Hope this helps. Regards.

Steven Sim Kok Leong
Unix Administrator_5
Frequent Advisor

Re: sudoers and using #uid

The problem is that the user that runs the command has a username that is all caps which is causing the problem.

I dont have a way to specify the user invoking the command.
Steven Sim Kok Leong
Honored Contributor

Re: sudoers and using #uid

Hi,

Have you considered using Restricted SAM instead of sudo to provide escalated privileges but secure access? It also allows you to a menu-like system for ease of use.

#!/usr/sbin/sam

Hope this helps. Regards.

Steven Sim Kok Leong