-
-
Save vpalmisano/2a62d5c0d2bd6bf67f65ae65847dcf17 to your computer and use it in GitHub Desktop.
systemd service file for running a vncserver (e.g. tightvncserver)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vncserver service file for Debian or Ubuntu with systemd | |
# | |
# Install vncserver and tools | |
# e.g. apt-get install tightvncserver autocutsel gksu | |
# | |
# 1. Copy this file to /etc/systemd/system/vncserver@:1.service | |
# 2. Edit User= | |
# e.g "User=paul" | |
# 3. Edit the vncserver parameters appropriately in the ExecStart= line! | |
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels) | |
# 4. Run `systemctl daemon-reload` | |
# 5. Run `systemctl enable vncserver@:<display>.service` | |
# | |
[Unit] | |
Description=Remote desktop service (VNC) | |
After=syslog.target network.target | |
[Service] | |
Type=forking | |
User=<user_name> | |
# Clean any existing files in /tmp/.X11-unix environment | |
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' | |
ExecStart=/usr/bin/vncserver -geometry 1800x1000 -depth 16 -dpi 120 -alwaysshared -localhost %i | |
ExecStop=/usr/bin/vncserver -kill %i | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# vnc server xstartup file (~/.vnc/xstartup) for LXDE | |
# | |
# The sleeps seem to fix a bug where user input is not registered in vncviewer on client | |
# | |
# Fix to make GNOME work: | |
export XKL_XMODMAP_DISABLE=1 | |
# hack to allow sudo in vncviewer: | |
xhost +localhost | |
autocutsel -fork | |
sleep 2 | |
# unclear if the x-window-manager is needed: | |
x-window-manager & | |
sleep 2 | |
lxterminal & | |
sleep 2 | |
/usr/bin/lxsession -s LXDE -e LXDE & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment