I've followed the instructions here to set up a vncserver service: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04
I only used the section on setting up the vncserver service since I already had vnc4server installed.
Options for starting vncserver:
- Use the service I created by running:
sudo service vncserver start/stop/restart
. It works fine and kicks of the Xvnc4 process. - Simply type vncserver into the terminal.
In both cases, I have double checked that the Xvnc4 service associated with vnc4server is started and running using ps -aux | grep vnc
.
In both cases, a display is created and attached to display 1.
My problem: When I use option 1 to start my vncserver, I am unable to connect to the display created from my windows pc using vncviewer.
When I use option 2, I am able to connect to the display from my windows pc using vncviewer. I simply provide serverip:<display#>
.
Why can't I connect when I use option 1. Also, is the suggestion to setup a secure tunnel using something like putty and then connecting through it just for security? I ask because when I start my vncserver using option 2 above, I'm able to connect remotely using servername or ip:display#
without using putty or any kind of tunnel.
Here is my ~/.vnc/xstartup
:
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
Here is my /etc/init.d/vncserver
service file:
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="mo"
DISPLAY="1"
DEPTH="16"
#GEOMETRY="1024x768"
#GEOMETRY="1600x1200"
GEOMETRY="1366x768"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
. /lib/lsb/init-functions
case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISP$
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISP$
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
/etc/init.d/vncserver
file includes option-localhost
, you will need to tunnel the connection as indicated i.e.ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip_address
. See for example vncserver -localhost and ssh tunnelingssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip_address
? In putty settings? Or on a ssh session I connect to through putty?