WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: chpasswd for samba  (Read 3345 times)

Offline b1ackmai1er

  • Jr. Member
  • **
  • Posts: 95
chpasswd for samba
« on: April 18, 2011, 06:41:45 AM »
Is it possible to have a chpasswd for samba. i.e chsmbpasswd so we can change samba passwords in batch files

thanks

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
The only barriers that can stop you are the ones you create yourself.

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: chpasswd for samba
« Reply #2 on: April 18, 2011, 12:10:13 PM »
http://syslog.warten.de/verbose/2010/05/chsmbpasswd.html :P

That script was a bit primitive, here is a smaller equivalent:
while read x; do u=${x%:*}; p=${x#*:}; echo $p$'\n'$p|smbpasswd -s -a $u; done

Offline b1ackmai1er

  • Jr. Member
  • **
  • Posts: 95
Re: chpasswd for samba
« Reply #3 on: April 19, 2011, 08:24:40 AM »
Thanks guys!

Thats so cool.

Offline b1ackmai1er

  • Jr. Member
  • **
  • Posts: 95
Re: chpasswd for samba
« Reply #4 on: April 19, 2011, 09:10:53 AM »
Hi Again,

for simplicity, is there a way of doing this inline?

Thanks

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: chpasswd for samba
« Reply #5 on: April 20, 2011, 03:36:06 PM »
Hi Again,

for simplicity, is there a way of doing this inline?

Thanks

What do you mean, "inline?" You can save it as a script, say /usr/local/bin/chsmbpasswd, and make it executable with chmod +x chsmbpasswd.