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.
- 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.
- 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!
- 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
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;
- It one of those goofy random passwords that nobody can remember.
- 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:
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.