VNC server and client setup on Debian, OS X and Windows

Today at work i made a VNC server setup on a computer with OS X (working as a status screen), which led me to create this post.

VNC is a protocol and a program to remote connect to graphical desktops from one computer (client) to another computer (server).

VNC uses the RFB protocol which stands for remote framebuffer, and is used to send framebuffers of a window from one machine to another. RFB is cross-platform, so VNC can be setup for every kind of operating systems.

VNC/RFB's default port is 5900.



I recommend being logged in as root user when configuring the VNC server.

For the VNC server for Debian i will use one of the most popular programs for this, called vnc4server. To install vnc4server run:
$ sudo apt-get install vnc4server

To create a new password for your newly installed vnc server run $ vncpasswd.

Now you should be good to go.

To start a new VNC server daemon run $ vncserver :1 which will start a new instance running on port 5901. To kill the process run $ vncserver -kill :1.

You can configure screen resolutions etc. when starting the server. There is some flags for this. It could eg. be $ vncserver :1 -geometry 1280x1024 -depth 32 which would set the screen resolution and the color depth in pixels.

You can check if the process is running probably by checking if the port is busy with $ netstat -tulpn | grep ':5901' - i made a post about this here: Which ports are being used.

To connect to this server you need to know the server's ip-address, what port it is listening on with VNC, and what the password is (you just created it).

If you are in doubt about your servers ip-address, you can find it by running $ ifconfig, and then take a look at the inet addr row with your ethernet or wlan interface.

Now you should be good to connect to your computers graphic desktop remotely from your VNC client.


VNC clients exist in many variants for all platforms and systems! I easily connected through my iPhone earlier, and it worked really wel..

To find the right client for you, i reccommend you to take a look here, in the Debian docs:

It does not matter which operating systems you connect from tho. I connected to my Debian box from my OS X computer with ease.

To connect to the machine's graphical desktop which we created above in the Server section you would write something like this in the address-field of your client: vnc:// This holds the vnc:// protocol, the ip of the VNC server - (in my case), and the port - 5901.