修复用户bug
This commit is contained in:
parent
ed14128c30
commit
470500cc0d
@ -77,8 +77,8 @@ case $pick in
|
|||||||
echo "系统内没有该用户"
|
echo "系统内没有该用户"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
sed -i "s/^#\?$user_name.*/d" /etc/sudoers
|
sed -i "s/^#\?$user_name.*/d" /etc/sudoers &> /dev/null
|
||||||
pkill -u root
|
pkill -u $user_name
|
||||||
userdel -r $user_name &> /dev/null
|
userdel -r $user_name &> /dev/null
|
||||||
rm -rf "/home/${user_name}"
|
rm -rf "/home/${user_name}"
|
||||||
echo "用户删除成功"
|
echo "用户删除成功"
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [[ $UID != 0 ]]; then
|
||||||
|
echo "请以root权限执行该脚本"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
if ! command -v git &> /dev/null; then
|
if ! command -v git &> /dev/null; then
|
||||||
if [[ -f "/usr/bin/apt-get" ]];then
|
if [[ -f "/usr/bin/apt-get" ]];then
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
apt-get install git
|
apt-get install git -y
|
||||||
elif [[ -f "/usr/bin/apt" ]];then
|
elif [[ -f "/usr/bin/apt" ]];then
|
||||||
apt update -y
|
apt update -y
|
||||||
apt install git
|
apt install git -y
|
||||||
elif [[ -f "/usr/bin/pacman" ]];then
|
elif [[ -f "/usr/bin/pacman" ]];then
|
||||||
pacman -Syu --noconfirm
|
pacman -Syu --noconfirm
|
||||||
pacman -Sy --noconfirm git
|
pacman -Sy --noconfirm git
|
||||||
|
Loading…
Reference in New Issue
Block a user