Next, we can start inserting the command instructions that will allow us to manage the new service. The following block binds the command needed to start a VNC server, and feedback that it is being started, to the command keyword start.
case "$1" in
startvncstart)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
The next block creates the command keyword stop, which will immediately kill an existing VNC server instance.
stopvncstop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
The final block is for the command keyword restart, which is simply the two previous commands (stop and start) combined into one command.
restartvncrestart) $0 stopvncstop $0 startvncstart
;;
esac
Now try using the service and command to start a new VNC server instance:
sudo service vncserver startvncstart
===Connect to VNC server===
First create an SSH connection on your local computer that securely forwards to the localhost connection for VNC. On Linux or OS X(this requires the password for DB Server's non-root user mcnair):
ssh -L 5901:127.0.0.1:5901 -N -f -l mcnair 128.42.44.181
Now use Remmina/TightVNC Viewer/ETC to connect to the VNC server.
On Remmina, use localhost:5901. No username is fine. Password is: Go-AsK-Ed
[[File:Connection using Remmina.png]]
I am not an expert in Windows Shell and I am not sure how to SSH on Windows. The TightVNC Viewer has a ssh channel option, but I failed to connect to our VNC server on Windows.
==User management==