瀏覽代碼

Added script to remove a user

Théo Ertzscheid 2 年之前
父節點
當前提交
ab18253a0d
共有 1 個文件被更改,包括 21 次插入0 次删除
  1. 21 0
      removeperson

+ 21 - 0
removeperson

@@ -0,0 +1,21 @@
+#!/bin/bash
+. .env
+. funcs
+
+uid=$1
+if user_exists $uid; then
+    true
+else
+    echo "User $uid does not exist." 
+    exit 1
+fi
+
+read -p "Are you sure you want to delete user $uid [o/N] " a
+
+case $a in
+    y*|o* )
+	is_posix $uid && $LDAPOPTS cn=$uid,$GROUPSDN
+	ldapdelete $LDAPOPTS uid=$uid,$PEOPLEDN ;;
+    * )
+        exit;;
+esac