From 2238e00d68f486a7dbb18de66465f0acff070c26 Mon Sep 17 00:00:00 2001 From: jonoterc Date: Thu, 10 Oct 2013 17:23:57 -0400 Subject: 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 --- templates/check_samba_user | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 templates/check_samba_user (limited to 'templates/check_samba_user') 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 -- cgit v1.2.3