Permalink
Browse files

Netmin 5. Submitted by aurav Mishra, MSIT, Kolkata.

  • Loading branch information...
rohitgoyal18 committed Dec 13, 2011
1 parent d155cf7 commit 624c998bfb288d90567e10b34774acc127ed4297
Showing with 57 additions and 3 deletions.
  1. +29 −0 netmin/ipblock
  2. +28 −3 netmin/netmin
View
@@ -0,0 +1,29 @@
+clear
+echo -n "Enter the IP address to be blocked/unblocked "
+read IP
+echo "Do you want ot block or unblock this IP? (ON/OFF) "
+read ch
+if [ "$ch" == "ON" ]
+then
+APPEND="-A"
+INSERT="-I"
+elif [ "$ch" == "OFF" ]
+then
+APPEND="-D"
+INSERT="-D"
+else
+echo "Error!! You entered an invalid option...."
+exit 1
+fi
+iptables $INSERT INPUT -s $IP -j DROP
+iptables $INSERT OUTPUT -d $IP -j DROP
+iptables $INSERT FORWARD -d $IP -j DROP
+iptables $INSERT FORWARD -s $IP -j DROP
+echo "IP $IP block $ch. "
+iptables-save
+
+
+
+
+
+
View
@@ -60,14 +60,39 @@ echo '| 13. Undo NFS import |'
tput cup 23 30
echo '| 14. Undo NFS export |'
tput cup 24 30
+echo '| 15. Delete a User |'
+tput cup 25 30
echo '| Q. Quit |'
-tput cup 25 30
-echo '| Enter your choice |'
tput cup 26 30
+echo '| Enter your choice |'
+tput cup 27 30
echo '--------------------------------------------------'
-tput cup 25 55
+tput cup 26 55
read choice
case $choice in
+15) clear
+ echo -n "Enter the name of user to be deleted "
+ read name
+ if [ $name = "root" ]
+ then
+ echo "Cannot delete root!! "
+ read
+ exit 0
+ fi
+ echo "Please wait..."
+ cat /etc/passwd |grep $name>>gfile
+ if(test -s gfile)
+ then
+ userdel -r $name
+ echo "User deleted successfully"
+ else
+ echo "User does not exist"
+ fi
+ rm gfile
+ echo "Press enter to return to main menu"
+ read
+ ;;
+
4) clear
tput cup 10 30
printf " Name the user whose password is to be changed: "

0 comments on commit 624c998

Please sign in to comment.