Wednesday, 19 November 2014

OSA: User- add,delete,change access permissions for a file

while(true)
do

echo " MENU
------------------------------------------------------------------------------
1)Super User
2)Add user
3)Delete user
4)Change access permissions
5)Exit"

read choice
case $choice in

1) echo "act as super user inorder to add user
=============================================================================="
su
sh 3.sh s

;;

2) echo " add user
==============================================================================
Enter the User name -> "
read name
useradd $name
echo "User added successfully"
;;

3) echo " Delete user
==============================================================================
Enter the name of user to be deleted -> "
read username
userdel
userdel $username
echo "the user has been deleted"
;;

4) echo " change access permissions
==============================================================================
Enter the name of file ->"
read nfile
echo "Enter the access permissions for owner"
read owner
echo "Enter access permissions for group"
read group
echo "Enter access permisiions for user"
read other
chmod $owner$group$other $nfile
echo "Permissions changed"
;;

5) echo "Program terminated"
exit 0
;;

esac
done

No comments:

Post a Comment