NSLU2-Linux
view · edit · print · history

SWAT web config tool

SWAT (the Samba Web Administration Tool) is a tool for administering the Samba networking server. SWAT used to be included in the samba package, but has been moved into a separate samba3-swat package, which has a dependency on the xinetd package.

Install SWAT with this ipkg command:

 
ipkg install samba3-swat

Edit your rc.xinetd diversion script to register SWAT with xinetd. The diversion script should be in your Unslung directory (/unslung).

Warning : If you already created a rc.xinetd diversion script, you should only add the part from 'if' to 'fi' and insert it before the 'return 1' in your orginal script. Deleting or editing the other content may result in disabled services, which for example could disable your telnet access.

If you add the following content, SWAT should work out of the box:

  
#!/bin/sh
# Diversion script: /unslung/rc.xinetd
# Customize for your own use, do not delete your original content!
#

if ( [ ! -f /etc/inetd.conf ] || !(grep swat /etc/inetd.conf -q) ) then
  echo "swat stream tcp nowait root /opt/sbin/swat swat" >>/etc/inetd.conf
fi

return 1
 

Restart xinetd by executing the xinetd init script:

  
/opt/etc/init.d/S10xinetd
 

Once that is done just point your browser to http://IP-address-of-your-slug:901, and enjoy. More info on Samba 3 (inclusing SWAT) can be found on the web at: http://us3.samba.org/samba/docs/man/ .

Full control off SWAT is only given if you logon as root. (To be exact, the full control depends on the SWAT user having write access to /opt/etc/samba/smb.conf, so you can grant non-root users full control by changing this file's owner or access permissions.)

If you log in as any other user, you will only be able to read documentation and change your user's own passwod. A normal user only get the buttons: Home, Status, View and Password. The root users also gets the buttons to manage shares.

Addendum for Plug Users:

Quickie xinetd swat configuration:
SWAT (the Samba Web Administration Tool) is installed by default with the samba2 package.
1. First install samba2.

2. Create a root password for Samba because you will need this to log in to the SWAT interface:

    Type "smbpasswd -a root"

3. Xinetd is needed to initialize the swat service after samba2 is installed so install xinetd.

    Type "ipkg install xinetd"

4. Edit with vi or nano /opt/etc/xinetd.conf. Edit the only_from line to contain your subnet so you can access the service (change 192.168.0.0/24 to your local subnet)

5. Edit /opt/etc/xinetd.d/swat and insert the line "protocol = tcp" below the "socket_type = stream" line and edit the only_from line to match the xinetd.conf file.

Here is what the resulting "swat" file approximately looks like:

     service swat
    {
            port    = 901
            socket_type     = stream
            protocol        = tcp
            wait    = no
            only_from = localhost 192.168.xxx.xxx/24
            user    = root
            server  = /opt/sbin/swat
            log_on_failure  += USERID
            disable =  No
    }

6. Now we need to install the protocols and services file from http://tech.groups.yahoo.com/group/nslu2-general/files/Plug%20Files/ but first we need access to the root file system since it is read only:

    Type "mount -o rw,remount /"

7. Change to /etc directory with "cd /etc" and download the 2 files with:

    "wget http://tech.groups.yahoo.com/group/nslu2-general/files/Plug%20Files/services"
    "wget http://tech.groups.yahoo.com/group/nslu2-general/files/Plug%20Files/protocols"

8. Now Start xinetd (notice you do not have to append start):

    Type "/opt/etc/init.d/S10xinetd"

9. Use your browser by accessing this address "http://IP-address-of-your-PlugPro:901"

10. If you want to always have swat accessible or are using xinetd for any other communication utility the place S10xinetd in your rcS or mount_optextX file. If you are just performing a one-time configuration then just manually run S10xinetd when needed and nobody else will have access to swat but you. You can make your rootfs read only again:

    Type "mount -o ro,remount /"
view · edit · print · history · Last edited by OddballHero.
Based on work by OddballHero.
Originally by Jim DeLaHunt.
Page last modified on February 24, 2011, at 09:58 AM