54 lines
687 B
Bash
Executable File
54 lines
687 B
Bash
Executable File
#!/bin/bash
|
|
|
|
Create_user(){
|
|
|
|
echo
|
|
echo -n "Username: "
|
|
read uname
|
|
|
|
useradd -m -G wheel,storage,audio,video,optical,lp,network,dbus,xbuilder -s /bin/bash ${uname}
|
|
|
|
echo
|
|
|
|
if [ -d /home/${uname} ];then
|
|
echo "User ${uname} created"
|
|
else
|
|
echo "User creation failed"
|
|
fi
|
|
}
|
|
|
|
Remove_user(){
|
|
echo
|
|
echo -n "Username to delete: "
|
|
read duser
|
|
|
|
userdel ${duser}
|
|
if [ -d /home/${duser} ];then
|
|
rm -R /home/${duser}
|
|
else
|
|
echo "User creation failed"
|
|
fi
|
|
}
|
|
main(){
|
|
|
|
while true;do
|
|
|
|
clear
|
|
echo
|
|
echo "[1] - Add User"
|
|
echo "[2] - Remove User"
|
|
echo
|
|
echo -n "Choose: "
|
|
read choice
|
|
|
|
|
|
if [ "${choice}" = "1" ];then
|
|
Create_user
|
|
else
|
|
echo "no"
|
|
fi
|
|
done
|
|
}
|
|
|
|
Create_user
|