touch /etc/init.d/vncboot
#!/bin/sh
# /etc/init.d/tightvncserver
# Customised by Stewart Watkiss
#http://www.penguintutor.com/linux/tightvnc
# Set the VNCUSER variable to the name of the user to start tightvncserver under
VNCUSER='pi'
eval cd ~$VNCUSER
case "$1" in
start)
su $VNCUSER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC server for $VNCUSER "
;;
stop)
pkill Xtightvnc
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
chmod 755 /etc/init.d/vncboot
update-rc.d /etc/init.d/vncboot defaults
or
update-rc.d vncboot defaults
Change default 5900 port
vim.tiny /usr/bin/vncserver
$vncPort = 5900 + $displayNumber;
Tunnel VNC over SSH
ssh -L 5901:127.0.0.1:5901 -N -f -l rocky 192.168.1.100 (run where vncserver is running)
vncviewer 127.0.0.1:5901 (run on the client machine, localhost – that is right, the tunnel is already up)
No clipboard?
Run autocutsel -fork (on the remote machine)