34 lines
No EOL
1.1 KiB
Bash
34 lines
No EOL
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
|
|
# Install Xfce desktop environment and related packages
|
|
apt-get update -y
|
|
apt-get install -y xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
|
|
# Install and configure Xrdp
|
|
apt-get install -y xrdp
|
|
sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
|
|
systemctl enable xrdp
|
|
systemctl restart xrdp
|
|
# Open firewall ports
|
|
ufw allow 3390/tcp
|
|
# Create user with password
|
|
useradd -m -s /bin/bash username
|
|
echo "username:password" | chpasswd
|
|
# Set up VNC server
|
|
apt-get install -y tightvncserver
|
|
su -c "echo 'password' | vncpasswd -f > ~/.vnc/passwd" username
|
|
chmod 0600 /home/username/.vnc/passwd
|
|
echo "#!/bin/sh" > /etc/init.d/vncserver
|
|
echo "" >> /etc/init.d/vncserver
|
|
echo "export USER='username'" >> /etc/init.d/vncserver
|
|
echo "eval cd ~\$USER" >> /etc/init.d/vncserver
|
|
echo "" >> /etc/init.d/vncserver
|
|
echo "/usr/bin/vncserver :1 -geometry 1280x720 -depth 16 -localhost" >> /etc/init.d/vncserver
|
|
echo "" >> /etc/init.d/vncserver
|
|
chmod +x /etc/init.d/vncserver
|
|
update-rc.d vncserver defaults
|
|
# Clean up
|
|
apt-get clean
|
|
rm -rf /var/lib/apt/lists/*
|
|
# Reboot the system
|
|
shutdown -r now |