5

I'm setting up a small QNAP for our department. I created an account for myself, and another one for the other admin - we don't want to use the main "admin" account unless necessary. I tried to switch to root prompt and this happens:

[Misiak@myQNAP ~]$ sudo -i
Password:
Misiak is not in the sudoers file.  This incident will be reported.

There is no sudoers file in /etc/sudoers or /usr/local/etc/sudoers None of the following groups exist when I try to use usermod -aG [group] [username]: sudo, wheel, operators.

What do I need to do? I'm completely new to this.

2 Answers2

4

For firmware 4.3.3, the sudoers file can be found under /usr/etc/

3

Your question's title ("where is sudoers?") and actual problem ("what should I do?") are a bit at odds because the solution is not to edit sudoers.

As @sam pointed out in the comment, sudoers - and even worse /usr/etc/sudoers.d - are recreated on startup, so your changes will not persist. The best (only?) way to have persistent sudoers on a QNAP NAS is to add entries under /usr/etc/sudoers.d from autorun.sh, as mentioned on the QNAP forums. For example:

echo "Misiak ALL=(ALL) ALL" > /usr/etc/sudoers.d/Misiak

The process to edit autorun.sh is itself a bit convoluted and varies for each NAS model. For examples, the script for "All AL-based NAS(TS-x31+ and TS-x31X) and TS-x31" is:

ubiattach -m 6 -d 2
/bin/mount -t ubifs ubi2:config /tmp/config
vi /tmp/config/autorun.sh
chmod +x /tmp/config/autorun.sh
echo .
echo "unmounting /tmp/config..."
umount /tmp/config
ubidetach -m 6

Find scripts for other models on the QNAP wiki.

NB. I haven't verified this, but it may also be possible to install a custom sudo according to the QNAP forums:

  1. Create your own username and edit the access permission for SSH in the QNAP controlpanel
  2. Install Entware
  3. Login as admin with ssh.
  4. opkg update
  5. opkg install sudo
  6. Edit /opt/etc/sudoers and add " ALL=(ALL) ALL"
  7. Logout and login with your own username
  8. In the user directory add a file with the name ".profile" and add the line "export PATH=/opt/bin:$PATH"
  9. logout and login DONE