Changes

Jump to navigation Jump to search
#!/bin/bash
PATH="$PATH:/usr/bin/"
export USER="usermcnair"
DISPLAY="1"
DEPTH="16"
GEOMETRY="1024x7681920x1080"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
. /lib/lsb/init-functions
 
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
vncstart)
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.
vncstop)
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.
vncrestart)
$0 vncstop
$0 vncstart
;;
esac
exit 0
 
Made this service script executable:
sudo chmod +x /etc/init.d/vncserver
 
Now try using the service and command to start a new VNC server instance:
sudo service vncserver vncstart
 
===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==

Navigation menu