Skip to content

Instantly share code, notes, and snippets.

@albertohm
Forked from ayosec/README.md
Created November 4, 2013 22:41
Show Gist options
  • Save albertohm/7310483 to your computer and use it in GitHub Desktop.
Save albertohm/7310483 to your computer and use it in GitHub Desktop.

Xvnc

The scripts in this gist will start an Xvnc server with a basic window manager (IceWM). This is intended to use in a virtual machine, where we can need to start a browser to run a test suite.

Installation on Debian

All commands have to be run as root

apt-get install icewm vnc4server
wget -O /etc/init.d/xvnc https://gist.github.com/albertohm/7310483/raw/5342e9e1705041939aa3e3e417de09c3d16131b1/xvnc.sh
wget -O /etc/init.d/icewm https://gist.github.com/albertohm/7310483/raw/b6ab30fb47dfdd5d4eccd64c540f1424db13b8d7/icewm.sh
chmod +x /etc/init.d/xvnc /etc/init.d/icewm
update-rc.d xvnc defaults
update-rc.d icewm defaults

Then, in your user, type

echo 'export DISPLAY=:0' >> ~/.bashrc
#!/bin/sh
### BEGIN INIT INFO
# Provides: icewm
# Required-Start: xvnc
# Required-Stop: xvnc
# Should-Start: icewm
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ice Window Manager
### END INIT INFO
PID_FILE=/run/icewm.pid
export DISPLAY=:0
cmd() {
action="--$1"
shift
start-stop-daemon $action \
--pidfile $PID_FILE \
--exec /usr/bin/icewm \
--name icewm \
--chuid 1000 \
--make-pidfile \
"$@"
}
case "$1" in
start)
cmd start --background
;;
stop)
cmd stop
;;
status)
cmd status
;;
*)
echo "Unknown option $1"
;;
esac
#!/bin/sh
### BEGIN INIT INFO
# Provides: xvnc
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: xvnc
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Xvnc
### END INIT INFO
PID_FILE=/run/Xvnc.pid
cmd() {
action="--$1"
shift
start-stop-daemon $action \
--pidfile $PID_FILE \
--exec /usr/bin/Xvnc \
--name Xvnc \
--chuid 1000 \
--make-pidfile \
"$@"
}
case "$1" in
start)
cmd start --background -- :0 -geometry 1440x900 -SecurityTypes None
;;
stop)
cmd stop
;;
status)
cmd status
;;
*)
echo "Unknown option $1"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment