Setup LXC Ubuntu server using QNAP Container Station

For a new project I am writing a small web application in the Go language. From the off I wanted to have a server setup to host the application so I can more easily test everything out. Being something of a DIY tech head I thought I’d use my QNAP NAS system to run the server since the hardware mostly just hosts my Time Machine backups at the minute and not much else.

QNAP has an application called Container Station which provides an easy way to setup web applications through Docker or run Linux instances with LXC. I’ve previously used this to setup a CouchDB instance with Docker so I decided to install Ubuntu as an LXC container to see if I could get it to run my web server.

Installing the Ubuntu is just a case of selecting “Create Container” and searching for “Ubuntu” and clicking the install button on the LXC listed item. Give the container a memorable name when prompted and then hit the button to create it.

Search for Ubuntu through the Create Container panel

Once created you can select the container from the containers list on the right to see its status and a console. It’s not immediately obvious but if you start typing the console give you a prompt. Also you can click the little arrows in the top right of the console panel to open a new tab with a console that fills the window.

The console is the grey area. Start typing to get the prompt to appear!

Now the initial installation of Ubuntu is really light weight so its time to install some stuff. We want to be able to ssh into the server from any machine on our network so update the package manager and then install openssh by running the following commands.

apt-get update
apt-get install -y openssh-server

We can’t be connecting as root so you’ll want to create a new user in the sudoers group so you can do everything else over ssh.



Follow the prompts to enter the password and the optional information that follows. Once your user is created make them a super user with the following command

usermod -aG sudo


Now we’re done. Almost. We have our ssh server and a user account but we still can’t connect because our container’s ssh port (22) isn’t exposed to the outside world. So back in the Container Station interface, open the Settings panel for the container. Select “Advanced Settings >>” to see the Network settings that allow you to control port forwarding. In the Port Forwarding table click the “Add” button to add an entry.

A new row is added to the table, you should then provide a port number for the host that will be mapped to your container’s ssh port. You can see my settings in the image below. Once you’re happy click “Apply” and the container will restart.

The advanced container settings hide the NAT options


Now you should be ready to ssh in from your desktop machine. Open a terminal (I’m using a Mac) and then run the following command to connect to your container.







Where username is the name of the user you setup, serveraddress is the IP address of your host server (Not the container) and finally hostport is the port number you entered for host in the port forwarding table.

If the wind is blowing in the right direction and geek gods are pleased with your work, you should be prompted for your password and then connected.

So that’s how I setup my initial server. In future post I’ll take this barebones server and get it to run a web server of my own creation. Thanks for reading.


  1. Hi Matt,

    Thank you for the informative guide of setting up Ubuntu lxc. I have followed the steps you mentioned in creating 3 separate ubuntu containers. I have a question regarding the root password. In my first instance I was able to change the password successfully for root, but for any new ubuntu lxc container instance I create I am not able to ‘su – root’ or even reset the root password (ubuntu password I am able to reset). I even tried the root password I set on the first instance on the other container station instances but that didn’t help. Is this a limitation in QNAP? I would think that any new instance would have its own root password. I get Authentication failure whenever I try to su – root. I opened up a ticket with QNAP support but they are not supporting as this is nothing to do with setup they said. Please let me know if you are facing the same issue or know of a solution.

    Thank you,

    1. Well I just created another Ubuntu container, changed the root password, added a new user, switched account and then switched back without any issues. I assume you are trying to change the password while you are logged in as root, as you can’t change the root password when logged in as another user. It doesn’t look like the default password is “ubuntu”, so if you switched user accounts before setting the root password you won’t be able to get back. When I accidentally did this while I was just playing about with it, I typed “exit” and it took me out of the new user session and back to root, so maybe give that a try and then try setting the password as the root user again.

  2. Excellent article, thanks for putting it out there. One small correction needed to the sentence “because our container’s ssh port (20)”. This should be 22.

  3. Hello Matt, very nice article. However I’ve ran into a problem which I hope you’re able to give some insight to. When using network mode “NAT” on the container, I’m not able to get any network access from the container, only when using “Bridge” as network mode I get network access though it seems as I can’t forward ports that way. Any ideas?


    1. Have you managed to get any other containers working, like a Docker WordPress server of something? If none of your containers work I would start by looking at your “Network and Virtual Switch” settings through the Control Panel. If you use the advanced mode you should be able to see the virtual switch configured for Container Station, maybe there’s something you can do there. After quick google I came across How to use and set up your Network & Virtual switch? on the Qnap site which might help.

Leave a Reply

Your email address will not be published. Required fields are marked *