Openresty Python LUA

Openresty Python LUA 学习资料 QQ群:397745473

0%

linux一键安装桌面系统脚本分析

linux一键安装桌面系统脚本分析

QQ群:397745473

linux一键安装桌面系统脚本分析

今天看到一个视频一键在google的notebooks中安装rdp环境,脚本写得很有创意,可以拿来学习一下

1
2
3
视频地址: https://www.youtube.com/watch?v=PwiTojLrIlg
文章地址: https://iecou.com/?p=408
GITHUB: https://github.com/alok676875/

脚本内容:

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
#! /bin/bash
printf "Check Out My Channel While Waiting- https://youtu.be/VeO22kIvZOQ" >&2
{
sudo useradd -m ALOK
sudo adduser ALOK sudo
echo 'ALOK:8426' | sudo chpasswd
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
sudo apt-get update
wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
sudo dpkg --install chrome-remote-desktop_current_amd64.deb
sudo apt install --assume-yes --fix-broken
sudo DEBIAN_FRONTEND=noninteractive \
apt install --assume-yes xfce4 desktop-base
sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
sudo apt install --assume-yes xscreensaver
sudo systemctl disable lightdm.service
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg --install google-chrome-stable_current_amd64.deb
sudo apt install --assume-yes --fix-broken
wget https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_20.0.2-1.deb
sudo dpkg -i crossover_20.0.2-1.deb
sudo apt install --assume-yes --fix-broken
sudo apt install nautilus nano -y
sudo apt -y install obs-studio
sudo apt -y install firefox
sudo adduser ALOK chrome-remote-desktop
} &> /dev/null &&
printf "\nSetup Completed " >&2 ||
printf "\nError Occured " >&2
printf '\nCheck https://remotedesktop.google.com/headless Copy Command Of Debian Linux And Paste Down\n'
read -p "Paste Here: " CRP
su - ALOK -c """$CRP"""
printf 'Check https://remotedesktop.google.com/access/ \n'
printf 'Your SUDO Pasword Is 8426 \n'
printf 'Terminal issue solve - https://youtu.be/XZxxaNWJxT0'

分析参考:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
printf "Check Out My Channel While Waiting- https://youtu.be/VeO22kIvZOQ" >&2
打印方法使用printf

{
命令...
} &> /dev/null &&
用大括号括上命令并一起执行. 然后把输出内容忽略

sudo useradd -m ALOK
增加用户

sudo adduser ALOK sudo
将用户加入sudo列表中

echo 'ALOK:8426' | sudo chpasswd
修改用户ALOK的密码

sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
更改bash为用户的默认shell


read -p "Paste Here: " CRP
su - ALOK -c """$CRP"""
使用ALOK用户执行脚本

QQ群:397745473

欢迎关注我的其它发布渠道