set password and delete useless lines

main
AhFei 2023-10-18 23:25:25 +08:00
parent 522f5eb6f2
commit a27eedc22d
1 changed files with 7 additions and 15 deletions

View File

@ -9,13 +9,11 @@ nml_user_name=${1}
nml_user_home=${2} nml_user_home=${2}
ss_user_name=${3} ss_user_name=${3}
new_port=${4} new_port=${4}
test_or_not=${5} password=${5}
test_or_not=${6}
SSHCONF="/etc/ssh/sshd_config" # sshd配置文件位置 SSHCONF="/etc/ssh/sshd_config" # sshd配置文件位置
github_project="docker/compose" # 自动获取 docker compose 最新下载地址
tag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/${github_project}/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
# step 1: install # step 1: install
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf #修改系统变量 echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf #修改系统变量
@ -23,20 +21,20 @@ echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf #修改系统
sysctl -p #保存生效 sysctl -p #保存生效
sysctl net.ipv4.tcp_available_congestion_control #执行 sysctl net.ipv4.tcp_available_congestion_control #执行
apt update apt-get update
apt -y install sudo curl vim git apt-get install -y sudo curl vim git
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
curl -fsSL https://get.docker.com | bash curl -fsSL https://get.docker.com | bash
echo "step 1: install has finished" echo "step 1: install has finished"
# step 2: localize # step 2: localize
useradd -d /home/${nml_user_home} -m ${nml_user_name} useradd -md /home/${nml_user_home} -s /bin/bash ${nml_user_name}
usermod -s /bin/bash ${nml_user_name}
usermod -aG sudo ${nml_user_name} # 有些发行版 RN 的就没有sudo adm usermod -aG sudo ${nml_user_name} # 有些发行版 RN 的就没有sudo adm
usermod -aG adm ${nml_user_name} usermod -aG adm ${nml_user_name}
usermod -aG docker ${nml_user_name} usermod -aG docker ${nml_user_name}
echo `groups ${nml_user_name}` # set password
echo ${password} | passwd --stdin ${nml_user_name}
# 修改ssh端口和禁止root登陆 # 修改ssh端口和禁止root登陆
cp ${SSHCONF} ${SSHCONF}.bak cp ${SSHCONF} ${SSHCONF}.bak
@ -70,12 +68,6 @@ fi
# step 4: test cpu net etc # step 4: test cpu net etc
echo 1 | bash <(wget -qO- --no-check-certificate https://github.com/spiritLHLS/ecs/raw/main/ecs.sh) echo 1 | bash <(wget -qO- --no-check-certificate https://github.com/spiritLHLS/ecs/raw/main/ecs.sh)
# Geekbench 5 测试
# wget https://cdn.geekbench.com/Geekbench-5.4.5-Linux.tar.gz && \
# tar -xzvf Geekbench-*.tar.gz && rm Geekbench-*.tar.gz && \
# mv Geek*/* ./ && rmdir Geekbench-* && \
# echo "now geekbench5!"
# ./geekbench5 > result_geekbench5.txt
docker run -d -e MODE=standalone -p 80:80 -it --name speedtest adolfintel/speedtest:latest docker run -d -e MODE=standalone -p 80:80 -it --name speedtest adolfintel/speedtest:latest