OSA: Practical 3

#!/bin/bash
while true
do
echo "------MENU-------"
echo "1.Add User"
echo "2.Delete User"
echo "3.Get Access Permission"
echo "4.Set Access Permission"
echo "5.Exit"
read choice
case $choice in
1)
echo "Enter new username to add"
read user;
useradd $user;
echo "User added Successfully"
ls /home ;;
2)
echo "Enter username to delete it"
read user;
userdel $user; 
rm -R /home/$user
echo "User deleted"
ls /home ;;
3)
touch just.txt
echo "Current Directory contents are"
ls;
echo "Enter file name to get Access Permission"
read file;
getfacl $file;;
4)
echo "Enter file name to set Access Permission"
read file;
echo "Enter Username"
read user;
echo "Enter permission"
read perm;
setfacl -m u:$user :$perm $file;
echo "Done!"
getfacl $file;
;;
5)
exit;;
esac
done

SHARE
    Blogger Comment
    Facebook Comment