diff options
author | jonoterc <jon_obuchowski@terc.edu> | 2013-10-10 17:23:57 -0400 |
---|---|---|
committer | Adam Jahn <ajjahn@gmail.com> | 2014-01-10 18:14:45 -0500 |
commit | 2238e00d68f486a7dbb18de66465f0acff070c26 (patch) | |
tree | 5cbc15aaf3671de32061d32e86006f601645e9b9 /templates/check_samba_user | |
parent | 699437673e6d17ba7d444d4916d93e40a2df0022 (diff) | |
download | puppet-samba-2238e00d68f486a7dbb18de66465f0acff070c26.tar.gz puppet-samba-2238e00d68f486a7dbb18de66465f0acff070c26.tar.bz2 |
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
Diffstat (limited to 'templates/check_samba_user')
-rw-r--r-- | templates/check_samba_user | 16 |
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 |