Modify group(%admin) with username in sudoers file
How can I transform/modify group(%admin) in sudoers file where users are added in the admin group as "%admin ALL=(ALL) ALL" but I want to relect with user name on thome the system belongs which should fetch username from a file or database.
Is there any bash script or other to process the same through puppet ?
Any solution will be appreciated.
Actually I have a list of username from my domain where users are added in %admin group as specified in /etc/sudoers file but I want to specify username instead of %admin for all the users which are in the list according to the owner of the system such as,
File (list of users):-
so want to replace %admin ALL=(ALL) ALL with David ALL=(ALL) ALL <--- System Owner is David
Mapple ALL=(ALL) ALL <--- System Owner is Mapple
And why are you wanting to do that? The 'admin' group is much more convenient and flexible in general...
However, if you wanted to systematically replace '%admin' then the following should help:
Needless to say, MAKE A BACKUP before doing ANYTHING with the /etc/sudoers file without using the visudo command. Or else.
Actually I want to replace the username's in the /etc/sudoers from a list of users from a database & also the users list should be compared with the system's owners name means,
if system owner (David) = David (from users list from database)
then replace "David ALL=(ALL) ALL" in /etc/sudoers instead of "%admin ALL=(ALL) ALL"
Also the same I want to push through puppet.
I hope now it should be cleared.
OK, so you have an abstract (NON-POSIX) group list out there somewhere, and you want to use that list under puppet to customize the sudoers file on a range of systems?
So first up, don't. Stick with user groups, I expect there's some way to keep this simpler model.
But after that, if this really is what you're going to do (and TBH I can see why it's not so bad - you have to make some sort of arbitrary mapping at some point, so maybe this point is OK) what is the association between the system and the user? It seems like an extremely puppet based solution is pretty simple. First thought to use an external arbitrary text list is to use an extlookup - http://docs.puppetlabs.com/reference...html#extlookup within a simple template file, but plenty of other solutions are also out there. I like using puppet-dashboard for this finer detail of config, in which you could add all the nodes within dashboard and use external node processing in puppet to pull in these little scrappy bits of data which you can manage fairly painlessly through a web interface.
|All times are GMT -5. The time now is 01:00 AM.|