Samba
Home Up thttpd Web Server Cherokee web CRON and SSMTP Samba Velleman K8055 Perl Module GD in Perl Slugos-native

 

The Samba File server and Swat control panel

Windows file sharing from a Linux server.

The package to perform this is called samba. It can be tricky to configure. There is a package called swat (samba web administration tool) that provides a web-based control panel for samba.

Swat is not ideal, in order to use it you still need to understand a lot of technical detail. The help system is invaluable though and you'll probably find that once you've learned enough to use swat well you'll be better off editing the samba config files directly.

Swat requires a daemon to run it when you try to connect. I'm using xinetd as I know this works.

Installing Samba:

There's a lot to install but fortunately it's all automated. Samba 3.0 installs and starts itself without problems on the systems I've tried.

root@zebidee:~# ipkg install samba
Installing samba (3.0.23c-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/samba_3.0.23c-r0_armeb.ipk
package ncurses suggests installing ncurses-terminfo
Installing libldap-2.3-0 (2.3.11-r3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libldap-2.3-0_2.3.11-r3_armeb.ipk
Installing libpopt0 (1.7-r3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libpopt0_1.7-r3_armeb.ipk
Installing libreadline4 (4.3-r3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/libreadline4_4.3-r3_armeb.ipk
Installing ncurses (5.4-r8) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/ncurses_5.4-r8_armeb.ipk
Configuring libldap-2.3-0
usage: update-rc.d [-n] [-f] [-r <root>] <basename> remove
       update-rc.d [-n] [-r <root>] [-s] <basename> defaults [NN | sNN kNN]
       update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] .
		-n: not really
		-f: force
		-r: alternate root path (default is /)
		-s: invoke start methods if appropriate to current runlevel
Configuring libpopt0
Configuring libreadline4
Configuring ncurses
Configuring samba
 Adding system startup for /etc/init.d/samba ...
  /etc/rc2.d/S20samba -> ../init.d/samba
  /etc/rc3.d/S20samba -> ../init.d/samba
Starting Samba: smbd nmbd.
  /etc/rc4.d/S20samba -> ../init.d/samba
  /etc/rc5.d/S20samba -> ../init.d/samba
  /etc/rc0.d/K20samba -> ../init.d/samba
  /etc/rc1.d/K20samba -> ../init.d/samba
  /etc/rc6.d/K20samba -> ../init.d/samba
root@zebidee:~# 

notes:

The samba package has dependencies, meaning there are other packages that must be installed in order for samba to work. ipkg has automatically installed the following other packages:

  1. libldap-2.3-0
  2. libpopt0
  3. libreadline4
  4. ncurses

The libldap-2.3-0 package appears to have an installation bug. Fortunately we won't be using ldap services so it won't matter but the text highlighted in cyan is the help text printed out when the command update-rc.d is called with incorrect parameters. Since update-rc.d is used to activate startup scripts this means that this package will not run at startup although it is meant to.

Installing swat:

root@zebidee:~# ipkg install swat
Installing swat (3.0.23c-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/swat_3.0.23c-r0_armeb.ipk
Killed
root@zebidee:~# 

My first attempt failed. The most likely cause is that a "memstick" install creates temporary files on a ram drive and if the ram drive fills up then the process that filled it is terminated. See "error: killed".

We try rebooting and trying again...

root@zebidee:~# ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/Packages.gz
Updated list of available packages in /var/lib/ipkg/cross
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/native/3.10-beta/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/slugos-bag/native/3.10-beta/Packages.gz
Updated list of available packages in /var/lib/ipkg/native
root@zebidee:~# ipkg install swat
Installing swat (3.0.23c-r0) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/swat_3.0.23c-r0_armeb.ipk
Configuring swat
root@zebidee:~#

Installing xinetd:

root@zebidee:~# ipkg install xinetd
Installing xinetd (2.3.13-r3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/3.10-beta/xinetd_2.3.13-r3_armeb.ipk
Configuring xinetd
Adding system startup for /etc/init.d/xinetd ...
/etc/rc2.d/S20xinetd -> ../init.d/xinetd
/etc/rc3.d/S20xinetd -> ../init.d/xinetd
Starting internet superserver: xinetd.
/etc/rc4.d/S20xinetd -> ../init.d/xinetd
/etc/rc5.d/S20xinetd -> ../init.d/xinetd
/etc/rc0.d/K20xinetd -> ../init.d/xinetd
/etc/rc1.d/K20xinetd -> ../init.d/xinetd
/etc/rc6.d/K20xinetd -> ../init.d/xinetd
root@zebidee:~# 

Configuring xinetd to run swat:

xinetd is controlled by configuration files located in the directory /etc/xinet.d/

Here's a configuration file to tell xinetd to run swat whenever it recieves a connection on port 901.

# default: off
# description: SWAT is the Samba Web Admin Tool. Use swat \
# to configure your Samba server. To use SWAT, \
# connect to port 901 with your favorite web browser.
service swat
{
disable = no
port = 901
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/swat
log_on_failure += USERID
}

http://www.boristheengineer.co.uk/slug/download/swat

Hint: the easiest way to get that file onto the slug is probably:

wget http://www.boristheengineer.co.uk/slug/download/swat

root@zebidee:~# cd /etc/xinetd.d
root@zebidee:/etc/xinetd.d# wget http://www.boristheengineer.co.uk/slug/download/swat
Connecting to www.boristheengineer.co.uk[212.159.9.131]:80
swat 100% |*****************************| 376 00:00 ETA
root@zebidee:~# /etc/init.d/xinetd restart
Stopping internet superserver: xinetd.
Starting internet superserver: xinetd.
root@zebidee:~#

Note the command to restart xinetd in order to force it to recognise the new configuration.

After this we can browse to port 901 of the slug and access swat. That's:

http://<slug ip address>:901/

Configuring Samba using swat

Guest only system (no passwords)