Also You can use "expect" command to do this. This is a sample program I used to change unix user passwords. You can edit it to do this job.

#!/bin/sh
# \
exec expect -f "$0" ${1+"$@"}
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
sleep 1
expect "assword:"
send "$password\r"
expect "assword:"
send "$password\r"
expect eof



On 06/12/2011 08:53 PM, TAKAHASHI Motonobu wrote:
From: Jigar Patel<[email protected]>
Date: Tue, 7 Jun 2011 16:36:28 -0700

(snip)
So I have user password into variable so now need to
tweak smbpasswd that way that is going to take my variable password instead
of asking me. Thanks in advance.
You can do this like that:

# (echo password; echo password) | smbpasswd -s monyo
Password changed for user monyo

---
TAKAHASHI Motonobu<[email protected]>  / @damemonyo
   http://damedame.monyo.com/ / http://facebook.com/monyot

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Reply via email to