From: jonoterc Date: Thu, 10 Oct 2013 21:23:57 +0000 (-0400) Subject: adding a shell script for checking whether a samba account exists for a given user X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2238e00d68f486a7dbb18de66465f0acff070c26;p=puppet-samba.git adding a shell script for checking whether a samba account exists for a given user will be leveraged by a puppet class; only tested against Ubuntu 12.04 --- 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