]> gitweb.fluxo.info Git - puppet-samba.git/commitdiff
adding shell script for creating a new smb account
authorjonoterc <jon_obuchowski@terc.edu>
Thu, 10 Oct 2013 21:23:18 +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/add_samba_user [new file with mode: 0644]

diff --git a/templates/add_samba_user b/templates/add_samba_user
new file mode 100644 (file)
index 0000000..1385d4e
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# This script adds a samba account for a given user and password
+# call as:
+# > add_samba_user "USERNAME" "PASSWORD"
+
+/bin/echo -e "$2\n$2\n" | sudo /usr/bin/pdbedit -a "$1" -t 1>/dev/null
+results=$?
+
+if [ $results = 0 ]; then
+       echo "added samba account for '$1'"     
+else
+       echo "could not add samba account for '$1'"
+fi
+
+exit $results