Menu

[r2016]: / trunk / etc / rc.d / smbpasswd  Maximize  Restore  History

Download this file

33 lines (24 with data), 816 Bytes

#!/bin/sh
# Copyright (c) 2007 Volker Theile (votdev@gmx.de)
# All rights reserved.

# PROVIDE: smbpasswd
# REQUIRE: smbd
# KEYWORD: nostart

. /etc/rc.subr
. /etc/configxml.subr

name="smbpasswd"
command="/usr/local/bin/${name}"

# Display message.
echo "Updating smbpasswd."

# Clear password database.
cat /dev/null > /var/etc/private/smbpasswd

# Generate /var/etc/private/smbpasswd Samba password database.
# Iterate over all configured users.
_usernum=`configxml_get_count "//access/user"`
while [ ${_usernum} -gt 0 ]
do
	_username=`configxml_get "//access/user[position()=${_usernum}]/login"`
	_password=`configxml_get "//access/user[position()=${_usernum}]/password"`

	(/bin/echo "${_password}"; /bin/echo "${_password}") | ${command} -s -a "${_username}" > /dev/null

	_usernum=$(( ${_usernum} - 1 ))
done
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.