

Test the script with this operation: ~/x11vnc.sh Next, make the script executable: chmod +x ~/x11vnc.sh We will then set the script to run at login: echo "/usr/bin/x11vnc -forever -bg -usepw -httpdir /usr/share/vnc-java/ -httpport 5901 -display :0" > ~/x11vnc.sh To configure autostart of x11vnc on the server:Īdd the command, that we use to start the VNC server, to a script in your home directory. Disable it by going to system preferences > Sharing and un-tick/de-select ‘Screen Sharing’. NOTE: In order to connect successfully to the tunnelled ‘localhost’ you must disable screen sharing on your mac.


We’re using OSX’s built in VNC viewer, so in finder: shift+cmd+k and type: vnc://localhost Start the x11vnc vnc server on the Ubuntu server: x11vnc -forever -bg -usepw -httpdir /usr/share/vnc-java/ -httpport 5901 -display :0 On you mac, enter the following to tunnel port 5900 to server port 5900 over SSH (it would be more secure to use non-standard ports).
#Vnc connect to ubuntu install#
Install the VNC server on Ubuntu: sudo apt-get install x11vncĬonfigure the password for VNC (you will be promoted to enter and then confirm the password and for a location to store it – I used the default values): x11vnc -storepasswd
#Vnc connect to ubuntu how to#
This time, after having a server compromised recently I wanted a more secure way of connecting to VNC from remote locations so here I will also explain how to setup an SSH tunnel for the VNC session. I’ve configured VNC for ubuntu on a couple of occasions and it’s always taken me far longer than necessary.
