![]() |
Samba 2.2.12It 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 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: Point your browser to Running Samba2 with xinetd, not as DaemonIt 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) memoryTo 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;
Addendum for Plug Users:Samba2 Optware package is an excellent choice for plugs as it is for slugs. For beginners, swat is also suggested. 1. Install samba2 with ipkg after making the root file system write accessible: Type "mount -o rw,remount /"
Then "ipkg install samba2"
2. Configure samba by going to /opt/etc/samba with "cd /opt/etc/samba" and editing the smb.conf with your favorite editor after making a back up copy. Type "cp smb.conf smb.conf.org" 3. You can now edit smb.conf or use swat to set up samba. If you are doing this manually, here is a sample smb.conf for testing purposes only. Adapt it to your system and security needs (this has none) . Would also suggest modifying your smb.conf and not overwriting with this: [global]
workgroup = WORKGROUP
server string = Samba2 Server
hosts allow = 192.168.1. 127.
null passwords = yes
map to guest = bad user
guest account = root
log file = /opt/var/log/samba/log.%m
max log size = 50
security = share
encrypt passwords = yes
smb passwd file = /opt/etc/samba/smbpasswd
dns proxy = no
preserve case = yes
[Clouds]
comment = Share all Cloud Engines drives.
path = /tmp/.cemnt
available = yes
public = yes
writable = yes
printable = no
read only = no
create mask = 0777
guest ok = yes
browseable = yes
For Mac OSX clients it is necessary to set "encrypt passwords = yes" to be able to log on. A good resource for learning how to set up samba is in chapter two of: http://www.samba.org/samba/docs/using_samba/ch00.html 4. You need to add users to your system (do this for each user you want to add to your system): Type "adduser -H sambausername" with sambausername to be what you want to add to the system password file.
Then "smbpasswd -a sambausername" to add it to the samba user password file.
5. Now you can start samba and check for errors: Type "/opt/etc/init.d/S80samba start" 6. If there are any errors, fix them and you can start samba again. If you change the configuration file you can type "/opt/etc/init.d/S80samba restart". If you want to stop the samba server, type "/opt/etc/init.d/S80samba stop". 7. You can add the command "/opt/etc/init.d/S80samba start" to your rcS file or the mount_optextX file. 8. Make your root file system read only after finishing with: Type "mount -o ro,remount /" 9. When you connect to your plug the share name will be Clouds. So in Linux convention "//Pogoplug/Clouds". In MAC OSX, Go->Connect_To_Server->smb://Pogoplug then choose Clouds and enter your username and password. |