Last active
August 29, 2015 14:18
-
-
Save orimanabu/a9e67101978b8b7b477b to your computer and use it in GitHub Desktop.
VNC server setup script for RHEL7/CentOS7
This file contains hidden or 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/bash | |
if [ x"$#" != x"2" ]; then | |
echo "$0 username display" | |
exit 1 | |
fi | |
user=$1; shift | |
display=$1; shift | |
unitfile=/etc/systemd/system/vncserver@:${display}.service | |
yum -y install tigervnc-server | |
homedir=$(getent passwd ${user} | cut -d: -f6) | |
dotvnc=${homedir}/.vnc | |
mkdir -p ${dotvnc} | |
vncpasswd passwd | |
mv passwd ${dotvnc} | |
chmod 600 ${dotvnc} | |
cp /lib/systemd/system/[email protected] ${unitfile} | |
sed -i.orig -e '/^[^#]/s/<USER>/root/g' ${unitfile} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment