修复用户bug

This commit is contained in:
lsy 2024-09-24 18:29:44 +08:00
parent ed14128c30
commit 470500cc0d
2 changed files with 8 additions and 4 deletions

View File

@ -77,8 +77,8 @@ case $pick in
echo "系统内没有该用户"
exit
fi
sed -i "s/^#\?$user_name.*/d" /etc/sudoers
pkill -u root
sed -i "s/^#\?$user_name.*/d" /etc/sudoers &> /dev/null
pkill -u $user_name
userdel -r $user_name &> /dev/null
rm -rf "/home/${user_name}"
echo "用户删除成功"

View File

@ -1,12 +1,16 @@
#!/bin/bash
if [[ $UID != 0 ]]; then
echo "请以root权限执行该脚本"
exit
fi
if ! command -v git &> /dev/null; then
if [[ -f "/usr/bin/apt-get" ]];then
apt-get update -y
apt-get install git
apt-get install git -y
elif [[ -f "/usr/bin/apt" ]];then
apt update -y
apt install git
apt install git -y
elif [[ -f "/usr/bin/pacman" ]];then
pacman -Syu --noconfirm
pacman -Sy --noconfirm git