8

I want to edit the sudoers file on my Synology Disk Station (specifically, to enabled password-less shutdown), however my version of Synology DSM does not have visudo installed.

How can I install it so I can safely edit the sudoers file?

4
  • 5
    In case you have a personal user (not just using a default one), you should be able to add configuration files in /etc/sudoers.d/ for your own account without any need for visudo. Commented Apr 24, 2020 at 6:41
  • 1
    Wow that worked. I put user_name ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown in /etc/sudoers.d/shutdown and it works. Some sites still recommend using visudo for sudoers.d so I'd still be happy with an answer to the original question. Commented Apr 24, 2020 at 6:53
  • User specific configuration files belong to etc/sudoers.d not in the main sudo config file Commented Apr 24, 2020 at 6:54
  • 4
    @StrabagISS_Krall I'm mostly worried about bricking my install with an incorrect sudoers file, or incorrect sudoers.d config file. My understanding is that visudo is supposed to check the formatting of the files to prevent you getting locked out with a bad config. Commented Apr 24, 2020 at 6:57

1 Answer 1

0

I accidentally bricked it and managed to get it back (using task planner / script as root).

In case you edit your sudoers file, make sure to keep an extra (or two) terminals open with ssh connected to your synology and sudo -i executed, so you have extra root prompts at hand to fix any. And make a backup of /etc/sudoers (e.g. sudo cp /etc/sudoers /etc/sudoers.bak) before editing. Then test with sudo -l with the user you're configuring to make sure you haven't messed up.

Anyways, putting your changes in /etc/sudoers.d/ is probably still the best thing to to.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.