Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 91951  / 2 Years ago, tue, october 11, 2022, 1:03:06

I would like to run x11vnc (or another VNC server) on my desktop, but I'm unable to find a way to get it to start before any users log in. Back when I was using vanilla Ubuntu 10.10 Vino did this by default. However, I can't find a way to do it now in Xubuntu.


More From » 11.10

 Answers
5

I usually suggest an alternate VNC server, x11vncserver or FreeNX.



FreeNX how to and download info



x11 VNC and docs



This assumes that VNC is setup and run-able:



Copy the code block below into /etc/init.d/vncserver. The easiest way to do it is to copy it to your clipboard, run sudo -i && cat > /etc/init.d/vncserver && exit in a terminal, paste it in, and type Ctrl-D`. Be sure to change the USER variable to whatever user you want the VNC server to run under.



#!/bin/sh -e
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Default-Start: 3 4 5
# Default-Stop: 0 6
### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="mythtv"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"

# The name that the VNC Desktop will have.
NAME="my-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;

restart)
$0 stop
$0 start
;;
esac

exit 0


Make the script executable with sudo chmod +x /etc/init.d/vncserver.



Then, run sudo update-rc.d vncserver defaults. This adds the appropriate symlinks to the vncserver script so that it is sent the start and stop commands at the appropriate time.



Note: you may need to use sudo update-rc.d vncserver 99 instead if the job is running too early in the boot process.



To start the server without rebooting, run sudo /etc/init.d/vncserver start



Finally, connect to your server with a VNC client on port 590X, where X is the value of "DISPLAY" in the vncserver script



source


[#41740] Wednesday, October 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hamostic

Total Points: 403
Total Questions: 142
Total Answers: 112

Location: Iceland
Member since Sat, Sep 17, 2022
2 Years ago
;