User Tools

Site Tools


os:nas:truenas:sudo

OS - NAS - TrueNAS - sudo

Tested on TrueNAS 12.0-U4.

FreeNAS uses /etc/local/sudoers as sudoers file, but this gets overwritten by /conf/base/etc/local/sudoers on reboot.

On TrueNAS 12 /etc/local/sudoers is not overwritten by /conf/base/etc/local/sudoers, so you can't make changes permanent by writing them to /conf/base/etc/local/sudoers.

Instead on TrueNAS 12 /etc/local/sudoers is “rewritten” based on /usr/local/lib/python3.9/site-packages/middlewared/etc_files/local/sudoers.

In addition files that are placed in /conf/base/etc/local/sudoers.d/ are placed in /etc/local/sudoers.d/ after a reboot, but /etc/local/sudoers by default does not include an includedir directive to use files in /etc/local/sudoers.d/.

To make sudoers use an includedir on TrueNAS 12:

  1. Add the includedir to /usr/local/lib/python3.9/site-packages/middlewared/etc_files/local/sudoers:
    echo "@includedir /etc/local/sudoers.d" >> /usr/local/lib/python3.9/site-packages/middlewared/etc_files/local/sudoers
  2. And to not have to reboot to apply the changes also to /etc/local/sudoers:
    echo "@includedir /etc/local/sudoers.d" >> /etc/local/sudoers

After this it is now possible to place your own files with sudoers lines in both:

  • /etc/local/sudoers.d/ to be active immediately.
  • /conf/base/etc/local/sudoers.d/ to be restored after reboot.
os/nas/truenas/sudo.txt · Last modified: 2021/08/10 12:14 by bas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki