dwchan
Enthusiast
Enthusiast

can you script sudo?

In general, if you want to edit sudo, you suppose to use visudo. But what if i am doing a script build? Can you just copy and replace a sudo configuration file directly? or use sed within the sudo config file? Basically, is there a way to automate the configuration of sudo?

0 Kudos
3 Replies
mcowger
Immortal
Immortal

All visudo does is some locking and syntax checking. If you are sure about your file, go ahead and replace the while thing at will. Same with running sed on it - just be sure its right, and everything is fine.

Here, we actually create our sudo file from an NIS map.

--Matt

--Matt VCDX #52 blog.cowger.us
Texiwill
Leadership
Leadership

Hello,

Yes you can script the creation of /etc/sudoers or even just plain overwrite it without impacting anything. However, if it is messed up you may allow more access or no access depending on its contents.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education. As well as the Virtualization Wiki at http://www.astroarch.com/wiki/index.php/Virtualization

--
Edward L. Haletky
vExpert XIII: 2009-2021,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
dwchan
Enthusiast
Enthusiast

thank you

0 Kudos