Solved Scripted visudo updates
-
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
-
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
-
So you prob have more complicated sudo rules than that but you get the point.
-
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
Gotcha, so yeah I'd just setup a touch and vi process to add a file to that location with my permissions.
Thanks for the clarity.
-
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
Gotcha, so yeah I'd just setup a touch and vi process to add a file to that location with my permissions.
Thanks for the clarity.
use
cat
instead of vi to automatically write the filecat > /etc/sudoers.d/dustin <<\EOF dustin ALL=(ALL) NOPASSWD: ALL EOF
-
@IRJ said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
Gotcha, so yeah I'd just setup a touch and vi process to add a file to that location with my permissions.
Thanks for the clarity.
use
cat
instead of vi to automatically write the filecat > /etc/sudoers.d/dustin <<\EOF dustin ALL=(ALL) NOPASSWD: ALL EOF
Or just use SED to modify it.
-
@scottalanmiller said in Scripted visudo updates:
@IRJ said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
Gotcha, so yeah I'd just setup a touch and vi process to add a file to that location with my permissions.
Thanks for the clarity.
use
cat
instead of vi to automatically write the filecat > /etc/sudoers.d/dustin <<\EOF dustin ALL=(ALL) NOPASSWD: ALL EOF
Or just use SED to modify it.
He is creating a new file, but yeah if he was just adding to
/etc/sudoers
-
So no matter how I set up this file, when I go and test it, I'm getting syntax issues.
Definitely going to keep working on this, but need some food.
-
Well I managed to get the file created, I had to use visudo to create a custom file with my edits.
I'm testing it now to see if everything works.
-
@IRJ said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
@stacksofplates said in Scripted visudo updates:
Just drop in a file with the sudo permissions there. A good convention is to name the file the user/group name and then put the user or group in the file with the permissions. It should be picked up by the system then. That's just the dump directory for configs so you don't have to edit
/etc/sudoers
So would I simply drop a file with my Cmnd_Alias and users there?
Sorry (just looking to see an example)
Here's an example. The file could be called
dustin
:dustin ALL=(ALL) NOPASSWD: ALL
Gotcha, so yeah I'd just setup a touch and vi process to add a file to that location with my permissions.
Thanks for the clarity.
use
cat
instead of vi to automatically write the filecat > /etc/sudoers.d/dustin <<\EOF dustin ALL=(ALL) NOPASSWD: ALL EOF
Or set up a template in your automation
-
@DustinB3403 said in Scripted visudo updates:
Well I managed to get the file created, I had to use visudo to create a custom file with my edits.
I'm testing it now to see if everything works.
Really? It doesn't let you just sudo a file in the dump directory? I wonder how they are enforcing that?
-
@stacksofplates said in Scripted visudo updates:
@DustinB3403 said in Scripted visudo updates:
Well I managed to get the file created, I had to use visudo to create a custom file with my edits.
I'm testing it now to see if everything works.
Really? It doesn't let you just sudo a file in the dump directory? I wonder how they are enforcing that?
Yeah, not sure why it was having a hissy fit over it, but I've got a good working custom sudoer.d/god file now that can be used for what I have, and I can simply cp that into the appropriate folder and reset the perms on it (if required) to get everything working.
Thanks for the help guys!