This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
forked from RattyDAVE/docker-ubuntu-xrdp-mate-custom
-
Notifications
You must be signed in to change notification settings - Fork 594
/
autostartup.sh
55 lines (49 loc) · 1.64 KB
/
autostartup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Set a timezone
if [[ -z "${TZ}" ]]; then
ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
else
ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
fi
chmod +x /xrdp-start.sh
# Format of the list of users
# separated by newline
# in createuser.txt
# to be created:
# user:pass:[Y/N]
# Y/N = add user to sudoers?
file="/root/createusers.txt"
if [ -f $file ]
then
while IFS=: read -r username password is_sudo
do
echo "$username:$password:$is_sudo"
if getent passwd $username > /dev/null 2>&1
then
echo "User Exists"
else
useradd -ms /bin/bash $username
usermod -aG audio $username
usermod -aG input $username
usermod -aG root $username
usermod -aG video $username
adduser $username pulse-access
mkdir -p /run/user/$(id -u $username)/dbus-1/
chmod -R 700 /run/user/$(id -u $username)/
chown -R "$username" /run/user/$(id -u $username)/
chown -R $username:root /home/vcbot
chown -R $username:root /home
echo "$username:$password" | chpasswd
if [ "$is_sudo" = "Y" ]
then
usermod -aG sudo $username
fi
fi
done <"$file"
fi
rm -rf /var/run/pulse /var/lib/pulse /root/.config/pulse
pulseaudio -D --verbose --exit-idle-time=-1 --system --disallow-exit
chmod +x /home/script.sh
bash /home/script.sh