Created
December 19, 2017 09:21
-
-
Save fcwu/b1fb4bae376181e3f59f23f5e2e3cdf5 to your computer and use it in GitHub Desktop.
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 | |
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