Addsudoers: A script to add users or groups into /etc/sudoers
Well, sudo is a great tool for delegating permissions among admins. But, it's really hard to find a great tool which would give an interactive way of editing /etc/sudoers file. Now, when I say "editing", I really refer to add new groups, users, aliases in the /etc/sudoers file. visudo is great tool, but again, we gotta edit the raw sudoers file. So, I was thinking of having some kind of a script which would simply prompt me what to enter and the script will take care of rest of the things like how to enter that information in the sudoers file.
So, here I want to share my work. It's not really a robust script. There is a lot of things to be implemented (details are mentioned in the script itself) yet.
So script gurus, grab the code, test it on different *nixes, modify it, play with it, and make it better. And yes, don't forget to distribute the code
Why edit groups into sudoers instead of adding users to groups? Let the login system do the legwork.
Uhhh...Well, we do not edit "groups" into sudoers. What we do is that we create an alias which is in turn a simple variable that holds a list of users. Thus, gives you extra flexibility on grouping your users depending on how they are going to use the system.
You can create a separate group of user, then assign that group in sudoers file with the commands and other stuffs. Or, you can create a User_Alias and add the users in that alias. It's upto you and your organization's policy. Both are possible.
Hi Team,
I got a requirement to send a mail to the individual users of a unix server about their respective groups. can some one help me to provide the script as I am unable to write that.
I tried with below lines but I come out with errors.
cat /etc/passwd | awk -F':' '{ print $1}' |... (6 Replies)
All,
I need to disable "sudo -i" and "su - " for all servers in our environment, We want to make sure no one run commands or delete files across environment using switching to root account. can you guys please lets me know if this is achievable.
Thanks and Regards
shekar (2 Replies)
Hi all. I need a shell script that can, in short, read through a text file line by line and create a new user in Ubuntu, as well as assign that user to a group. The format of the text file is not important but preferably: 'username:group'. I don't have much programming knowledge no matter shell... (3 Replies)
Hello,
I am new to Unix and shell scripting. I am trying to find unowned files and groups on my servers. I know, i could use the below command to find it on individual server.
#find / -nouser -o -nogroup -print
But I was wondering, if someone could help with a shell script so that I can... (2 Replies)
Hello gurus,
I've been working on a sudoers file to work with groups in LDAP. I've created the groups in LDAP and added the users to there respective groups. I've also setup my sudoers file to have the groups match what is in LDAP. And I've added ldap to nsswitch.conf in the group line. The... (6 Replies)
I'm trying to create a script to remove users from sudoers on multiple servers. I'm able to do this with a one-line script using sed, but only if it's on one server.
Example: sed '/someuser/d' /host/local/etc/sudoers
Also, I think the problem with this one-line script is that I would have to... (4 Replies)
hi eveyone i've recently requested my unix admin to create a userid for 2 groups. He created the id and i can see it by grep "id" /etc/group.
But when i login with that id into unix and try to cd that group it says permission denied. something like cd /groupname -- permission denied
Can my admin... (1 Reply)
RH 7.2
I'm trying to list the users & groups on my machine. I found the lsuser & lsgroup commands but no associated man pages.
I typed: lsuser
I get --> Valid options are: -a
So I typed: lsuser -a
I get --> Valid options are: groups, home
So I typed: lsuser -a groups
I get -->... (2 Replies)