Preface:
I know this is my first post on this board and I hope I am not overstepping my bounds by making it a tutorial. I went through every tutorial that was on the web trying to find some concise instructions about using one of the latest revisions of Samba on my Asus WL-500W router. What I found were pieces of information in many forum posts and in various old tutorials. In every case following the instructions to the letter did not result in a seamless deployment of Samba. It took me parts of three days to finally piece together enough information to get Samba up and running on the Asus. This is the reason for this tutorial.
There is a working version of Samba 2 embedded within the firmware but this tutorial will not use that version, instead installing Samba 3.
Prerequisites:
• Working WL-500 family router
• Oleg Firmware
• USB Storage device
You must have a working Asus WL-500W Router. In my case it is set up as a residential gateway but these instructions should work whether you are using it as a router or access point also.
Your router must be properly flashed with the latest stable version of Oleg's firmware. This tutorial will not demonstrate how to flash your router, there are others better suited for that. Oleg's firmware page is located here:
You must have a USB storage device attached to your router. I would recommend a hard disk drive to provide a large enough place to store everything you might want to either archive or move from computer to computer in your home network.
Setup:
There are a few things that you must do in order to prepare for the Samba installation. I will mention them in passing. This tutorial will assume you are at a point where you can download and install packages onto your router.
You will be installing optional packages on your router so make sure you have your external USB storage device installed, partitioned, formatted and mounted correctly beforehand.
Make sure that you have Samba disabled in the web interface. The following screen shot will show you where that is.
Once off you can exit out of the web interface as you will no longer be using it and will instead be doing everything from telnet or SSH (if installed).
At this point telnet into your router and log in. You will be at the root directory. I have my USB drive installed with two partitions, the first is a primary partition used for storage mounted as /opt, the second is a small Linux swap partition.
The first thing we need to do is to download a new version of ipkg and supporting components. You can find it here:
At the telnet command line issue the following commands:
Code:
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-13_mipsel.ipk
ipkg.sh install uclibc-opt_0.9.28-13_mipsel.ipk
The first thing we must upgrade is the uclibc package, as the options package will not install on the current version. Once installed download and install the options with the following telnet command:
Code:
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-10_mipsel.ipk
ipkg.sh install ipkg-opt_0.99.163-10_mipsel.ipk
At the time of this writing uclibc-opt_0.9.28-13_mipsel.ipk and ipkg-opt_0.99.163-10_mipsel.ipk were the most current versions, please check the URL listed above to verify the correct files.
Once installed ipkg must be updated and all upgrades applied. Issue the following commands:
Code:
ipkg update
ipkg upgrade
You can list all packages that are installed along with their version numbers with the following optional command:
Code:
ipkg list_installed
On your attached USB drive create a folder for the latest version of Samba, download and install it now.
Code:
mkdir /opt/sambaNew
cd /opt/sambaNew
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/samba_3.2.7-1_mipsel.ipk
ipkg install samba_3.2.7-1_mipsel.ipk
Now that everything is installed we need to create some configuration files create some shares and configure Samba to start at boot up after the drive is mounted. If you have not installed a text editor I would recommend you install nano. It is a mini version of VI and works very well in a telnet or SSH session. To install nano issue the following command: ipkg install nano
At this point we will assume nano has been installed. Now you will need to create a working configuration file for Samba. That file will be located in /opt/etc/samba. To create that file using nano issue the following command:
Code:
nano /opt/etc/samba/smb.conf
The following code is an example of a working smb.conf file please not that some things need to be changed to match your particular configuration.
Code:
[global]
workgroup = WORKGROUP
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 1
max log size = 100
encrypt passwords = yes
dns proxy = no
netbios name = ASUS_SAMBA
server string = Asus WL-500W
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_SNDBUF=8192
bind interfaces only = yes
interfaces = 192.168.1.1/24
hosts allow = 192.168.1.1/255.255.255.0
[share1]
path=/opt/share/samba1
read only = no
writeable = yes
browseable = yes
public = yes
[pictures]
path=/opt/share/samba2
read only = no
writeable = yes
browseable = yes
public = yes
A few things to note here, in the global section change WORKGROUP to the name of the actual workgroup you are using, you may also change the netbios name and server string. You must include the interfaces line as this version of Samba cannot automatically find the interface it must bind to. This took quite some time to figure out and inserting it will alleviate hours of searching for reasons why your samba deployment does not work. The second and third sections are there for example and illustrate the actual setup of shares. Please note the shares in this example are called share1 and pictures and that is exactly how they will appear in your network list. I would suggest that you give each one a meaningful name. Also note that each is a separate path, we will configure the paths shortly.
One more file needs to be created before we finish up with all the directory creation and configuration. Issue the following command, again using nano as our text editor:
Code:
nano /opt/etc/init.d/S08Samba
Here is an example of a typical S08Samba file:
Code:
#!/bin/sh
# set samba_active=1 to activate samba
samba_active=1
[ 1 = $samba_active ] || exit 0
if [ -n "`pidof smbd`" ] ; then
echo "Stopping smbd:"
killall smbd
fi
if [ -n "`pidof nmbd`" ] ; then
echo "Stopping nmbd:"
killall nmbd
fi
sleep 2
/opt/sbin/smbd -D -l /opt/var/log/smbd.log -s /opt/etc/samba/smb.conf
/opt/sbin/nmbd -D -o -l /tmp -s /opt/etc/samba/smb.conf
Now we move on to creating directories and making sure all the files have the appropriate attributes. At the telnet prompt issue the following commands:
Code:
mkdir /opt/share/samba1
mkdir /opt/share/samba2
chmod 777 /opt/share/samba1
chmod 777 /opt/share/samba2
chmod 755 /opt/etc/init.d/S08Samba
At this point all of our changes need to be stored and committed to the flash ram. If you do not do this next step you will need to redo much of what we have done here. In order to make these changes permanent issue the following commands, and reboot your router:
Code:
flashfs save
flashfs commit
flashfs enable
reboot
If everything works the way it should you should have working Samba shares. to verify that Samba is running telnet back into the router and issue the following command:
By upgrading to this or newer versions of Samba you also eliminate the need to run secpol.msc or registry edit anything on Windows Vista.
Additional Notes:
There seems to be another command that some people have found necessary to execute in order to get Samba up and running properly. I am not sure if I did this or not in my implementation as I had to try a lot of different things before it was working for me.
Another user mentioned that using guest account = nobody in smb.conf might not work and should be changed to a user that specifically has access to the files.
There are other forum posts and tutorials online to do things like having specific user access configured for Samba shares and WAN access. I did not want or need these features so this tutorial restricts itself to setting up Samba the way I wanted to use it. Please note that I am not a Linux user or even knowledgeable about Linux in general. The information presented here is to simply outline the steps that I was able to collect from various sources on the web into a concise guide for others to use. If there are corrections or easier ways to do some of these things, please let everyone know your experience.
I have also included this tutorial as a .PDF file you can download, you may view and/or print out if you cannot stay attached to the internet while performing these operations.