Samba 2.2.12
It looks like Samba 3 is too big for all "swapless" routers.
For this reason I have prepared Samba 2 packages with Samba Web Admin Tool which will ease config and admin for samba newcomers. SWAT interface looks like:
Installation and running samba 2 is done out of the box by the following commands:
/opt/bin/ipkg update
/opt/bin/ipkg remove samba
/opt/bin/ipkg install samba2
/opt/bin/ipkg install xinetd
/opt/etc/init.d/S10xinetd start
/opt/etc/init.d/S80samba start
Edit /opt/etc/xinetd.d/swat :
find the line: only_from = localhost 192.168.1.0/24
and change the subnet to that of your own network, eg. I use 192.168.15.* so I changed it to 192.168.15.0/24
Save and quit editor, and restart xinetd: /opt/etc/init.d/S10xinetd restart
Point your browser to http://YOUR.I.P.ADRESS:901/ to administer samba,
and only for openwrt: replace "admin" with "root".
Running Samba2 with xinetd, not as Daemon
It is possible to run the whole samba package on demand with xinetd.
You first have to prevent samba running as daemon:
rm /opt/etc/init.d/S80samba
Two files are needed to start the daemons with xinetd:
First file:
/opt/etc/xinetd.d/netbios-ns
with following content:
service netbios-ns
{
disable = no
socket_type = dgram
protocol = udp
port = 137
user = admin
wait = yes
only_from = localhost YOUR.PRIVATE.SUB.NET/24
server = /opt/sbin/nmbd
}
Second file:
/opt/etc/xinetd.d/netbios-ssn
with following content:
service netbios-ssn
{
disable = no
socket_type = stream
protocol = tcp
port = 139
user = admin
wait = no
only_from = localhost YOUR.PRIVATE.SUB.NET/24
server = /opt/sbin/smbd
}
Edit both file for your IP (on openwrt replace also user "admin" with "root" and change server path).
Only for openwrt you need to do this:
echo "netbios-ns 137/udp" >> /etc/services
echo "netbios-ssn 139/tcp" >> /etc/services
and restart xinetd.
Runing samba on FLASH (USB stick) memory
To minimize FLASH wear, redirect all logs and temporary databases to /tmp/samba
directories. One way to do is to create startup script like
#!/bin/sh
if [ -n "`pidof smbd`" ] ; then
echo "Stopping smbd:"
killall smbd
fi
if [ -n "`pidof nmbd`" ] ; then
echo "Stopping nmbd:"
killall nmbd
fi
#sleep 2
echo "Starting smbd:"
if [ ! -d /tmp/samba ]; then
mkdir /tmp/samba
mkdir /tmp/samba/log
rm -rf /opt/var/log/samba
ln -s /tmp/samba/log /opt/var/log/samba
rm -rf /opt/var/samba
ln -s /tmp/samba /opt/var/samba
fi
/opt/sbin/smbd -D;
echo "Starting nmbd:"
/opt/sbin/nmbd -D;