2

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.

5
  • Not a programming question - try Server Fault ?
    – Paul R
    Jan 18 '18 at 15:34
  • Also, it's my recollection that there is a useful user-support community specific to QNAP. Did you try search the internet for 'QNAP support forum'. Good luck.
    – shellter
    Jan 18 '18 at 15:54
  • 1
    @shellter Thanks for the tips. I didn't realize how vast this community was. As to the QNAP forum, I kind of trust stackexchange more and the people here reply faster. From what I found so far, people generally don't use QNAP this way in companies - they use it for storage connected to an actual webserver or they install packages that I can't use. So I couldn't find my problem. Jan 18 '18 at 19:49
  • I believe the qnap "server" is very similar in scope to the WD MyCloud "server" which in it's first incarnation was a stripped down Linux, and in later versions is a horribly crippled busy-box environment. It is very likely that QNAP doesn't have the facility to run sudo at least without figuring out to how to install it. Good luck!
    – shellter
    Jan 18 '18 at 20:55
  • @shellter Yeah, it is crippled, but when I told my manager "Would be cool if our department had a NAS" I never expected to be the one to pick a model and become the admin, so I'll have figure this out ;) I'm pretty sure this one has some kind of sudo, because I can use the command from the root account and trying from another account does not return a "command not found". Jan 22 '18 at 11:26
4

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

1
  • I think it would be noteworthy to indicate that any changes to this file are not persistent. The file is regenerated at reboot and all your changes will be lost.
    – Sam
    Apr 1 '19 at 23:31
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.