]> gitweb.fluxo.info Git - puppet-samba.git/commitdiff
adding a shell script for checking whether a samba account exists for a given user
authorjonoterc <jon_obuchowski@terc.edu>
Thu, 10 Oct 2013 21:23:57 +0000 (17:23 -0400)
committerAdam Jahn <ajjahn@gmail.com>
Fri, 10 Jan 2014 23:14:45 +0000 (18:14 -0500)
will be leveraged by a puppet class; only tested against Ubuntu 12.04

templates/check_samba_user [new file with mode: 0644]

diff --git a/templates/check_samba_user b/templates/check_samba_user
new file mode 100644 (file)
index 0000000..75cb4b5
--- /dev/null
@@ -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