System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Quick Question on Sudoers file

Mike_305
Super Advisor

Quick Question on Sudoers file

Hello All,

I have several servers where I have add few lines to sudoers file and not good with scripting.

Few lines I am trying to add under "# Cmnd alias specification" and few lines "# User privilege specification".

Now, the question that I have is can add at the bottom of file and things will work or they have to go in a set order at correct location in the file.

The reason I am asking because I have 100+ servers and don't want to "vi" the file on each server to keep the correct format. I was planning to just echo the lines and add them at the bottom of file.

Like they say quantity and quality don't go together.

Thanks for your help in advance.

Regards,

MJ
If there is problem then don't think as problem, think as opportunity.
6 REPLIES
Kevin Wright
Honored Contributor

Re: Quick Question on Sudoers file

create a std file and scp it around the environment... however you *should* be able to add to the end assuming no conflicting entries.
Steven Schweda
Honored Contributor

Re: Quick Question on Sudoers file

> [...] don't want to "vi" the file on each
> server [...]

Does each server have a unique file, or can
you edit one, and then copy it around?

If not, then many editors can be scripted.


> Like they say quantity and quality don't go
> together.

In my experience, they can coexist just fine.
Mike_305
Super Advisor

Re: Quick Question on Sudoers file

Hello,

Sorry, each server could have different file. also some servers have sudoers file under /etc/ and some might have under /opt.

Regards,

Mike
If there is problem then don't think as problem, think as opportunity.
Tingli
Esteemed Contributor

Re: Quick Question on Sudoers file

Yes, you can add the new lines in the end of file sudoers. The problem is it is hard for you to check the sudo in the future. So, it is better to give them a good comment.
singh sanjeev
Trusted Contributor

Re: Quick Question on Sudoers file

make out the list as per loaction of sudoers:
list1 and list2

if ssh_keys are distributed on the system you can do it in follwoing way:

for server in `cat list1`
do

ssh $server "echo "sudoer entry" >> /filelocation"

done

Hope u will test before you run it..

All the best.
Sanjeev Singh
Mike_305
Super Advisor

Re: Quick Question on Sudoers file

Thanks for everyone's help.

Regards,

MJ
If there is problem then don't think as problem, think as opportunity.