Page 1 of 1

QNAP – How to set the VNC Password for Linux Station

QNAP – How to set the VNC Password for Linux Station

For modern and more powerful QNAP devices, you can now run a complete Linux environment on your NAS. In this case by using Linux Station which basically runs a Ubuntu variant.

Since Linux Station is not really running as a virtual machine, it runs pretty fast. You can even hookup a HDMI monitor and a USB mouse and Keyboard to your QNAP and use it as a workstation. But most of us do not use their QNAP that way. Instead you can access Linux Station through their webbrowser, or … VNC.

VNC access comes with a challenge though. What the heck is the password? No matter what you do in the remote desktop settings, the password is fully ignored.

In this short article I’ll show you how to set a password – albeit in a not so conventional way.

Get started with Linux Station

Obviously this article is not about how to start Linux Station, but I’ll give you the quick steps.

  1. Make sure your QNAP model supports Linux Station!
    If you have an older or lower powered QNAP, like with an ARM or Atom based CPU, then you can forget about this option – Linux Station is not supported on your QNAP. Sorry.
  2. Install Linux Station on your QNAP.
    Open the “App Center” and find “Linux Station“. Click “Install” to add it to your QNAP. It’s free!
  3. Install Ubuntu on your Linux Station.
    Open the “Linux Station” app and select “Install Ubuntu 16.04 add-on from Linux Containers website“.
    At the time that I’m writing this you can get Ubuntu 14.04, Ubuntu 16.04 and Ubuntu Kylin 16.04 (Chinese Ubuntu).
    Obviously this may change in the future.


OK give it a whirl. To not have to drag a monitor, mouse and keyboard to your QNAP, you can use the remote desktop feature which runs in your browser. In essence this is simply VNC. In the screenshot below: check the “Enable Remote Desktop” option. Just below that you will see the link that will open the remote desktop in your browser.

QNAP - Linux Station

QNAP – Linux Station

I want to use VNC!

So, what bothered me about the browser approach is that it’s slow. OK for a few clicks, but not OK if you want to do more.
Also, the link only seems to work when you’re actually logged into the QNAP web-interface. Not practical for quick access.

In essence this is all based on VNC (the remote access) so why not use a regular (faster) VNC client?

It took some effort to find out what the password was. I have seen several posts pointing to methods that no longer seem to work, and then I noticed that there is a well hidden file with the password. To access Terminal, first click the link in the lower right corner that says “Please use the following URL“, so you can access Ubuntu.

After that you can work in Linux Station through your browser, there you can open a Terminal window and execute the following:

sudo more /tmp/.qnap/vncpassword

It will show the password needed to connect with VNC – give it a try. I used MacOS ScreenSharing but feel free to use any VNC client.

What is the IP address of Linux Station? 

The IP address can be seen in Linux Station, see screenshot above, just under the bold blue words “Remote connection“.

Awesome that worked!
Ehm … not entirely … there are 2 major problems with this password;

  1. It one of those goofy random passwords that nobody can remember.
  2. After restarting Linux Station or the Ubuntu you’re running, the password changes.

The first one I can deal with the second one … yikes!

Set your own VNC Password for Linux Station

Well, it seems that Linux Station, or maybe more correct the Ubuntu setup, is generating a random password each time it starts for VNC access.

With the following steps we can make that our own – all these steps are done in a terminal window in Linux Station!

Create a service that creates (overwrites) the vncpassword file for us.

By the best of my knowledge, this is the correct way to do this, although I can imagine there are better ways. Hopefully QNAP changes this in the future to something we can manage from Linux Station or in Ubuntu.

The file we are going to create is: /etc/systemd/user/setmyvncpassword.service

We start this by executing the following in terminal:

sudo nano /etc/systemd/user/setmyvncpassword.service

This will open nano, a pretty easy to use text editor. Feel free to use any other plain text editor like “vi” etc.
Since we execute this as administrator (sudo), you will be asked for the admin password. I found (on my QNAP anyway) that this is the same password as for the admin of my QNAP.

The content of this file:

Description=set my password for vnc
ExecStartPre=/bin/mkdir -m 0700 -p /tmp/.qnap
ExecStartPre=/bin/bash -c "echo MYPASSWORD > /tmp/.qnap/vncpassword"

Note that you’d want to change “MYPASSWORD” to your own password of course.
You should probably not use the same password as the one you use for the login on your QNAP.

OK, if you worked with nano, then close it by pressing CTRL+X, answer the question by pressing the “Y” key, and press ENTER for the filename.

The next steps are to make sure this new “service” is being activated, and actually will fire at boot time;

sudo systemctl enable /etc/systemd/user/setmyvncpassword.service

Again, this may require you to enter the sudo password again.

Now it’s time to restart Linux Station. I tried the command-line approach (shutdown -r now) but that comes with strange results.
Instead I found clicking the “Restart” button in Linux Station to work just as well.

Once you have restarted Linux Station, verify that the file /tmp/.qnap/vncpassword indeed holds your password as content.

If all went well, you should now always be able to get into your Linux Station, straight from VNC without the need to login to your QNAP.

Black Screen with VNC 

Since one of the recent updates of QTS, VNC turns or starts black when you have used the web-interface to access Ubuntu. By using the web-interface, the screen gets blanked (no matter what you try, and you cannot “wake up” the screen either).

To avoid or fix this:
1) Disable Ubuntu (in Linux Station).
2) Enable Ubuntu (in Linux Station).
3) Make sure “Enable Remote Desktop” is checked.
4) Start your VNC Viewer.

DO NOT click the link show behind “Please use the following URL“.
If you do, the screen will get blanked again – follow the 4 steps above again to disable this “feature”.


Donation options

Donations are very much appreciated, but not required. Donations will be used for web-hosting expenses, project hardware or a motivational boost (a drink or snack). Thank you very much for those have donated already! It's truly AwEsOmE to see that folks like our articles and small applications.


There are 22 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.

  • Jan 26, 2018 - 2:37 AM - Piotr Comment Link

    Thank you, finally real and simple solution!!



    • Feb 16, 2018 - 10:18 AM - hans - Author: Comment Link

      Awesome! Glad it worked for you as well.
      I hope QNAP will implement this in their web interface soon though … 



  • Feb 28, 2018 - 9:56 AM - Joe Comment Link

    Hi thanks for this tuto.

    I can’t tested yet because the option remote connection is grey so I can’t enable it …

    Did you know why ? I succeed the first time and I was disconnect because a timeout. So then when I connect again the option was disable and impossible to enable it again.

    Thank you



    • Mar 3, 2018 - 5:28 AM - hans - Author: Comment Link

      Hi Joe,

      mine remains grey in the first few second when opening the page in the QNAP web interface.
      If the “virtual” machine is not running it will remain grey as well. In that case you will have to click “enable” or “restart” and wait a few seconds.

      Hope this helps.



  • May 13, 2018 - 1:38 PM - Andy Comment Link

    Maybe an odd question – but how do you access the terminal if you can’t login to start with. Have I missed a step?




    • May 14, 2018 - 5:23 AM - hans - Author: Comment Link

      Hi Andy,

      not really an odd question – good catch! 

      In figure 1 you’ll see a link in the lower right corner, which would open remote access through your webbrowser. This is where you can then open terminal and do the changes.
      just below the figure I wrote “When working in Linux Station, whichever Ubuntu version, open a Terminal window and execute the following”, but I admit this could have been made a little more clear. I’ll update the text right away! 




  • May 26, 2018 - 4:18 AM - Andrea Comment Link


    my Linux Station has a weird behavior: I am able to access it through a VNC client but i am able to see the desktop if and only if the Remote Desktop Webpage is open, otherwise the VNC clients connects but shows just a black window. Do you have any clue on what could cause this behavior?




    • May 27, 2018 - 9:13 AM - hans - Author: Comment Link

      Hi Andrea,

      I have not encountered this “effect” yet and honestly would not know what would cause this – unless your VNC client is not passing keyboard and mouse signals.
      Maybe give another VNC client a try?



    • Jun 28, 2018 - 10:12 AM - hans - Author: Comment Link

      OK, I just updated my QTS and I now have the same weird effect. 
      Looking into it and even started a conversation with QNAP about this issue.



    • Jun 28, 2018 - 10:35 AM - hans - Author: Comment Link

      OK, so I did some playing with all the settings and I seem to have to working, following these steps, of which I’m not sure if all of them are required.

      One time: Disable screen locking / screen saver in Ubuntu. (In Ubuntu: System Settings – Brightness & Lock: set “Turn screen off when inactive for” to “Never”, and make sure “Lock” is set to “OFF”).

      After that, I closed the browser window that is showing the Ubuntu desktop, disabled “Remote desktop” en re-enabled it again in “Linux Station”. After that I restarted Ubuntu in Linux Station, but DO NOT click the link provided in the “Linux Station” window in your QNAP user interface.
      Instead I open my VNC viewer right away and things seem to be working. No more black screen.

      I tested this a few times, and for now my procedure is:

      Start my VNC viewer right away and assume Ubuntu is running in Linux Station.

      If this fails: open Linux Station and make sure I see “Status : Enabled” (right under the Ubuntu logo, above the “Disable – Restart – Reinstall” buttons).

      If status is “Status : Enabled” but you still do not get connected (verify IP address) click “Restart“.
      If status is “Status : Disabled” click “Enable“.

      In both cases give it a few seconds to give it a chance to boot Ubuntu.

      I have repeatedly tested this and it seem to be working reliable for me. Hope it works for you as well.



  • Jul 21, 2018 - 11:49 PM - mankann Comment Link

    Thank you for this excellent, helpful and well written guide! 



    • Jul 30, 2018 - 4:46 AM - hans - Author: Comment Link

      Thank you Mankann for taking the time to post a thank-you note!
      Very motivating! 



  • Jul 27, 2018 - 6:04 AM - Kamal Singh Comment Link

    Hi After following the above step I can see the password of my choice is stored but i still get the error of password incorrect when i try connecting through VNC client, please help. My qnap is tvs 1282.


    Kamal Singh

    • Jul 30, 2018 - 5:01 AM - hans - Author: Comment Link

      Hi Kamal,

      did you try these steps?
      For some reason the webbased-VNC screws up the connection, so you’d want to avoid that.
      For the record; I just updated to QTS and my Linux Station stopped working all together, even re-installing doesn’t seem to work.



      • Jul 30, 2018 - 12:28 PM - Kamal Singh Comment Link

        Hi Hans, 

        Yes i tried all the steps but couldn’t get vnc client connection. The password seems to be changed of my choice but it is not acceptable to vm on Linux station. 

        I hadfew ussues on installing Linux station on ssd so. I installed it on capacity drive first then moved it to ssds. I wanted it to run from ssds dor obvious speed reasons. 


        Kamal Singh

        • Aug 8, 2018 - 6:26 AM - hans - Author: Comment Link

          I do not have a cooky cut answer for you, except for going through the steps agin.
          Unfortunately with the lastest Linux Station update, my Ubuntu non longer starts, so I created a VM instead.

          I would recommend reporting this to QNAP Support – it is ridiculous that they have not solved this issue yet or provided an easier way to work with this.



  • Dec 17, 2018 - 8:56 AM - Billy Comment Link

    Hellow, I’ve following your guide line, 

    But there were some service error. it’s cause from Linux version.  I can’t enable setmypassword.service. 

    Output like

     sudo systemctl --root=/ enable /etc/systemd/user/setmyvncpassword.service
    The unit files have no [Install] section. They are not meant to be enabled
    using systemctl.
    Possible reasons for having this kind of units are:
    1) A unit may be statically enabled by being symlinked from another unit's
       .wants/ or .requires/ directory.
    2) A unit's purpose may be to act as a helper for some other unit which has
       a requirement dependency on it.
    3) A unit may be started when needed via activation (socket, path, timer,
       D-Bus, udev, scripted systemctl call, ...).




    • Dec 19, 2018 - 9:55 AM - hans - Author: Comment Link

      Hi Billy,

      I’m nowhere near my QNAP, so I cannot verify what you’re running into.
      In the meanwhile I even gave up using Linux Station, as it became unstable after one of the recent QTS updates (instead I use a Docker for the specific application I’m using).

      I’ll be able to access my QNAP in about a month (I’m traveling), but I can imagine this to be a long wait.
      Alternatively; You can submit a support ticket with QNAP (and refuse remote access by them), maybe they changed something, requiring a new trick or (hopefully) they added setting a VNC password as a standard feature now.

      I’m sorry I could not be of more help … 



      • Dec 19, 2018 - 10:36 PM - Billy Comment Link

        I will try Docker as your recommendation, even I’ve never tried before 

        TThank you for your comment,  



        • Dec 20, 2018 - 9:52 AM - hans - Author: Comment Link

          You’re welcome Billy!

          As a side note:
          Docker (in my case anyway) seem to be often used for so called headless-setups (ie. there is no regular “screen”, instead there is often a web-interface). I’m definitely not an expert on Docker, it took me quite a bit of reading and testing before I got things working the way I want it. But … I have to admit that once it worked, I’ve been very satisfied with it.



  • Jan 18, 2019 - 9:55 PM - Hussain Comment Link


    Easy to follow ..

    Finally I find a solution .



Your Comment …

Friendly request to not post large files here (like source codes, log files or config files). Please use the Forum for that purpose.

Please share:
Notify me about new comments (email).
       You can also use your RSS reader to track comments.

Tweaking4All uses the free Gravatar service for Avatar display.
Tweaking4All will never share your email address with others.