QNAP: Activate root account on NAS

To activate the root account on a QNAP NAS perform following steps

  1. open QNAP Administration frontend in browser
  2. activate ssh under Network Services –> SSH/Telnet
  3. install Optware IPKG as described on http://wiki.qnap.com/wiki/Install_Optware_IPKG
  4. ssh to your NAS
    on a MAC open terminal and type

    where the ip is the ip of your QNAP NAS
    on windows use putty to connect
  5. Enter your admin account name and password
  6. update ipkg
  7. install sudo
  8. open passwd file
  9. copy line

    and change it to
  10. write file to disk (see infos about vi below)
  11. open shadow file

    copy line (the encrypted password will look different for you)

    and change it to
  12. write file to disk (see infos about vi below)
  13. open sudoers file
  14. copy

    to
  15. write file to disk (see infos about vi below)

Now you can sudo from your admin account and login with the root account which has the identical password as your admin account.

 

How to use vi:
press i for insert mode
press esc to exit inser mode
press : for command mode
enter wq and return (wq = write and quit)

 

 

  • John

    Good tutorial thanks.

    I prefer to use nano as I find it easier than vi. To copy a line press ctrl+k to cut a line then ctrl+u to paste the cut line back in repeatedly.
    Ctrl+x to exit, press ‘Y’ to save, and Enter to accept the same name
    To install nano ‘ipkg install nano’

    A few corrections:
    The password files are in /etc/, not /opt/.
    To edit the passwd file: ‘nano /etc/passwd’
    Change ‘admin:x:0:0:administrators:/root:/bin/sh’ to ‘root:x:0:0:administrators:/root:/bin/sh’
    To edit the shadow file: ‘nano /etc/shadow’
    To edit sudoers with nano, reset the environment variable for the editor: ‘EDITOR=nano’
    Then to edit sudoers just type: ‘visudo’ and press enter

    Hope that helps

    • Thanks for the update. It is already some time ago, since I have set everything up ;-)
      I prefer nano myself, but didn’t have it on my QNAP at that time.

  • Saihttam Schneider

    hello , i need help.

    when I go to the manual, I get after reboot no more master link to the server.

    • Matthias Einig

      Sorry, but the blogpost is over 4 years old. Certainly things have changed in the QNAP firmware since then. (Though it is still working on my QNAP).

      I suggest you check out the QNAP forums to get help for your issue http://forum.qnap.com/