Skip to content

Instantly share code, notes, and snippets.

@riblo
Created October 4, 2019 16:10
Show Gist options
  • Save riblo/ac5384f2e34745c4705bb0e5463bfdf8 to your computer and use it in GitHub Desktop.
Save riblo/ac5384f2e34745c4705bb0e5463bfdf8 to your computer and use it in GitHub Desktop.
VNC multi-user/multiple access generator
#!/bin/bash
# VNC multi-user/multiple access generator
# CentOS-7 tested
# account: user-1:user-1, user-2_user-2, etc
#useradd/passwd loop
for i in {1..5}; do useradd user-$i; done;
for i in {1..5}; do echo user-$i | passwd user-$i --stdin; done;
# xvnc configurations
cat > /etc/systemd/system/xvnc.socket << EOF
[Unit]
Description=XVNC Server
[Socket]
ListenStream=5900
Accept=yes
[Install]
WantedBy=sockets.target
EOF
cat > /etc/systemd/system/xvnc@.service << EOF
[Unit]
Description=XVNC Per-Connection Daemon
[Service]
ExecStart=-/usr/bin/Xvnc -inetd -query localhost -geometry 1920x1080 -once -SecurityTypes=None
User=nobody
StandardInput=socket
StandardError=syslog
EOF
cat > /etc/X11/xinit/xinitrc.d/99-vncconfig.sh << EOF
#!/bin/sh
vncconfig -nowin &
EOF
systemctl start xvnc.socket
systemctl enable xvnc.socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment