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 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 the 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. When working in Linux Station, whichever Ubuntu version, 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.

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 no comments yet.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.

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.