Vnc4server

From miki
Revision as of 15:22, 24 June 2017 by Mip (talk | contribs) (Created page with "== Install == Install package {{deb|vnc4server}}: <source lang="bash"> sudo apt install vnc4server </source> == Configuration == === Start at boot === We follow instruction...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Install

Install package vnc4server:

sudo apt install vnc4server

Configuration

Start at boot

We follow instruction on Ubuntu-fr.


First create file /etc/init.d/vnc4server:

  • Edit as necessary. In particular, replace all occurences of users vnc and vnc1 by user on your server.
  • If server already runs an X server, don't use :0 since it will not be available.
# /etc/init.d/vnc4server
#

# Enregistrement du log
touch /var/lock/vnc4server

# Gestion des paramètres de la commande vnc4server
case "$1" in
start)
echo "Starting script vnc4server "
su vnc -c 'vnc4server :0'
su vnc1 -c 'vnc4server :1'
;;
stop)
echo "Stopping script vnc4server"
su vnc -c 'vnc4server -kill :0'
su vnc1 -c 'vnc4server -kill :1'
;;
*)
echo "Usage: /etc/init.d/vnc4server {start|stop}"
exit 1
;;
esac
  
exit 0
  • chmod and add to init:
sudo chmod 755 /etc/init.d/vnc4server
sudo update-rc.d vnc4server defaults
  • Start the server, this will create a password entry for each VNC desktop:
sudo /etc/init.d/vnc4server start

Edit VNC configuration for each user:

vi ~USER/.vnc/xstartup
  • On XUbuntu, the line for x-terminal-emulator was incorect. The correct line:
x-terminal-emulator --geometry=120x50+10+10 --title "$VNCDESKTOP Desktop" &

Connect

On the client, run:

xtightvncviewer my_vnc_server:1         # Or :0, :2...

Troubleshoot

  • On the server, see .log files in ~/.vnc.