aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/check_samba_user16
1 files changed, 16 insertions, 0 deletions
diff --git a/templates/check_samba_user b/templates/check_samba_user
new file mode 100644
index 0000000..75cb4b5
--- /dev/null
+++ b/templates/check_samba_user
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# This script checks to see if a given user account exists on samba
+# if so, it returns 0
+# otherwise it returns 1
+
+sudo /usr/bin/pdbedit -L | egrep -q "^$1:"
+exists=$?
+
+if [ $exists = 0 ]; then
+ echo "'$1' is a samba user"
+else
+ echo "no samba account matching '$1'"
+fi
+
+exit $exists