Jump to content
wewantrice

Edit Sudoers List?

12 posts in this topic Last Reply

Recommended Posts

Hello all,

 

Tried searching but to no avail. I'm looking to add a user to the sudoers list, which I can temporarily do with visduo; however this does not survive a reboot. Is there any way I can make the change persist after reboot?

 

Thanks!

Share this post


Link to post

The only way to do so is to create your own install script and have that run on each startup.

Share this post


Link to post

Any pointers on how to do this? Specifically what I'd like to do is give non root users the ability to issue the powerdown command

Share this post


Link to post

Why do you have "users" needing to power down your unraid server in the first place?

 

 

But to help answer, you need to use the "go" file which is run at boot.

Share this post


Link to post

Longer answer:

 

Because the OS is running completely in RAM (this includes any "files" in the usual places, such as /etc/sudoers) any changes you make in the running OS is lost when you reboot.

 

To make a change that will survive a reboot, you need to make the system make those changes for you each time it boots.

 

This is usually done in /boot/config/go script file which is run automatically after the system boots.

 

 

Share this post


Link to post

Thanks for the help, what specifically would I have to put into the go file to add a user to the sudoers list? The reason I'm trying to do this is I usually remotely connect to my server via SSH under a non root user name and would like the ability to remotely reboot the server if necessary.

Share this post


Link to post

You can just add an echo line to your go file and pipe the line to the sudoers file. Its not recommended to edit this file directly without the syntax checking provided by visudo, but it does work well if you know exactly what you're doing. Alternatively you can edit the sudoers file via visudo and make a copy of it onto your flash drive and then have the go file overwrite the original on reboot.

 

Sent from my Galaxy Nexus using Tapatalk 2

Share this post


Link to post

For completeness.

 

add this to /boot/config/go

 

echo "USERNAME    ALL=(ALL) ALL" >> /etc/sudoers

Share this post


Link to post
On 2/9/2014 at 6:34 AM, detz said:

For completeness.

 

add this to /boot/config/go

 

echo "USERNAME    ALL=(ALL) ALL" >> /etc/sudoers

Thanks!!

Share this post


Link to post

Since this thread is nearly 5 years old it might be worth considering if there are better methods since.

 

Instead of adding to the go script. the preferred method of executing a script is with the User Scripts plugin. You can configure when your script runs, including at boot time.

Share this post


Link to post
Posted (edited)
46 minutes ago, trurl said:

Since this thread is nearly 5 years old it might be worth considering if there are better methods since.

 

Instead of adding to the go script. the preferred method of executing a script is with the User Scripts plugin. You can configure when your script runs, including at boot time.

THANKS!! I will look at switching out details in my /boot/config/go file to that right now, I didn't know it was out there very useful.

 

UPDATE: That plugin does not do things pre-mount just after the array mounts or on a schedule from what I can see.

Edited by Trunkton

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.