Root / power-user configuration on QNAP devices is a little bit different (quite weird) than this, what you can find on most Unix/ Linux systems. And sometimes you may be hit with error messages like “admin is not in the sudoers file. This incident will be reported“, “sudoers.so must be owned by uid 0” etc. Here are some tips on what to do in this case.
For second error, claiming that
sudoers.so file uid isn’t 0, first go to folder containing this file (
/opt/libexec/ on QNAP TS-210) and
ls -ls to check, who is current user of it. It should be
ls -ls chops names to 8 characters).
If it isn’t, change ownership of this file and
/opt/etc/sudoers folder, by executing:
chown admin:administrators /opt/libexec/sudoers.so
chown admin:administrators /opt/etc/sudoers
As for first error, saying, that admin is not in the sudoers file, you may try to execute
sudo usermod -aG sudo,adm admin, but this will most likely fail on QNAP.
If it does, then fix this manually as described in here:
visudo command to edit
- Scroll down contents of this file, until you reach
root ALL=(ALL) ALL.
- Hit Enter to add a new line below and write
admin ALL=(ALL) ALL.
- Hit Esc, enter
wq and hit Enter to save file and exit forsakend vi editor.
This is the only solution, that I found working on my QNAP TS-210.
All others, that required using GRUP, were impossible, as you don’t have access to GRUP during QNAP boot.