Samba Script
From WL-HDD Wiki
| WL-HDD Contents |
|---|
| What is the WL-HDD |
| Features |
| Pro's/con's |
| Reviews |
| Hacking |
| Inserting the HDD |
| Hacking Guides |
| Basic setup guides |
| Packages guides |
| Requests |
| Troubleshooting |
| This Wiki |
| Credits |
| Editing help |
| Contact Me |
Contents |
Prerequisites
To complete this guide, the following is assumed:
| You are running Oleg's firmware (1.9.2.7-6b or later) |
| You have harddisk partitions up and running with an extended filesystem mounted to /opt |
| You have installed the Ipkg package system. |
| You have configured your partitions to automount. |
| You have set the hostname of your WL-HDD in the web-interface (IP Config - LAN). |
This script has only gone through some very basic testing so may not work yet.
I am not responsible if this messes up your WL-HDD setup, in fact, I am not responsible for anything!
All feedback is welcome!
Despite the warning above, this script should not cause any irreversible problem to your WL-HDD!
Getting the Script onto your WL-HDD
OK, first of all, we need to get the script onto the WL-HDD so it can be executed.
There are a few ways of doing this:
Option 1: Wget
This command will download the script from the internet (will only work if you are connected!!!)
Go to the folder /opt
cd /opt
type the following:
wget http://www.sprayfly.com/wlhdd/scripts/sambasetup
Make it executable
chmod +x sambasetup
Now make any necessary changes (such as to workgroups, share names and share paths- read the comments inside the script when you nano it)
nano sambasetup
(changes)
Ctrl + O Ctrl + X
Now lets run it!!!
./sambasetup
Option 2: Pasting into nano
Go to the directory /opt
cd /opt
Now lets create sambasetup
nano sambasetup
Now paste into your editor the following, making changes to the workgroup name, samba shares and paths if necessary:
#!/bin/sh #Lets make the samba setup directory mkdir /opt/etc/samba #Lets make the configuration file- this part of the script needs editing! #Change the workgroup name to your workgroup #Change the share names to your own preference echo "[global] workgroup = <your workgroupname e.g. 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 server string = <your desired nameserver name e.g. wlhdd> [<your 1st sharename e.g. Share1>] path=/opt/share/shared1 writeable = yes browseable = yes [<your 2nd sharename e.g. Share2>] path=/opt/share/shared2 writeable = yes browseable = yes">>/opt/etc/samba/smb.conf #Now lets make the directories for those two default shares #If you also changed the share path in smb.conf then you will need to change the paths below to reflect changes mkdir -p /opt/share/shared1 mkdir -p /opt/share/shared2 #Now lets make the init file echo "#!/bin/sh /usr/sbin/smbd -D -l /opt/var/log/smbd.log -s /opt/etc/samba/smb.conf">>/opt/etc/init.d/S97Samba #If you want to see the WL-HDD samba server in 'My Network Places' (windows), add the lines: # this starts the samba "name-server" echo "/usr/sbin/nmbd -D -l /opt/var/log/nmbd.log -s /opt/etc/samba/smb.conf">>/opt/etc/init.d/S97Samba #Make the file executable chmod +x /opt/etc/init.d/S97Samba #Nice message, please keep this in: echo Samba Setup Complete! This Script was created by Jonathan Lumb. The wiki can be found at http://www.sprayfly.com/wiki
Now save and exit
Ctrl + O Ctrl + X
Make it executable
chmod +x sambasetup
Now lets run it!!!
./sambasetup
Now go to this page to check it works Basic_Samba#Check_it_works
