Skip to content

Instantly share code, notes, and snippets.

@fcwu
Created December 19, 2017 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcwu/b1fb4bae376181e3f59f23f5e2e3cdf5 to your computer and use it in GitHub Desktop.
Save fcwu/b1fb4bae376181e3f59f23f5e2e3cdf5 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ `id -u` != "0" ]; then
echo You have to run with root user
exit 1
fi
cat <<EOF | tee /etc/systemd/user/x11vnc-password.service
[Unit]
Description=x11vnc password
Before=x11vnc.service
[Service]
ExecStartPre=/bin/mkdir -m 0700 -p /tmp/.qnap
ExecStartPre=/bin/bash -c "echo PASSWORD > /tmp/.qnap/vncpassword"
ExecStart=/bin/true
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
systemctl enable /etc/systemd/user/x11vnc-password.service
echo OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment