mullac. codes

April 7, 2007

FreeNAS :: extending the CIFS shares

Filed under: Tech — callumj @ 4:01 am

I installed FreeNAS because I was sick of my poorly configured Samba on CentOS constantly hanging up and crashing the computers that were writing to it, so I decided to try FreeNAS.

I installed it and got my 300GB drive working perfectly, now for sharing. Sharing works fine yet I cannot edit how Samba shares each folder on the drive, I can only share a full mounted drive. There had to be a way, through the config!

Now FreeNAS doesn’t use the normal SAMBA config file location, it has placed it in /var/etc/smb.conf

I will show you how to edit and restrict users.

BUT AFTER USING THIS, DO NOT USE THE CIFS PAGE TO EDIT SAMBA! YOU HAVE TO USE THIS!

So first, go to the WebGUI and look for Edit File after Diagnostics (you will need to click Diagnostics first)

Screenshot 1

In the Edit File page, go to the File path: and type /var/etc/smb.conf and click Load.

Screenshot 2

Once loaded you should see a large config file, scroll down to the bottom to edit the mount points.

You should see your mount point in [xxxx] then a bunch of variables after it. My mount point is called nas

[nas]
comment =
path = /mnt/nas Here I can set if I want to share a certain directory. I have a folder called public inside the drive, so below I have made another share.
public = yes Should I secure it?
writeable = yes Can people write to it?
printable = no
#Old veto line that create problem with ‘icon’ named file for example
#veto files = /Network Trash Folder/Icon?/:2e*/.AppleDesktop/.AppleDB/.AppleDouble/TheFindByContentFolder/TheVolumeSettingsFolder/Temporary Items/.snap/
#This next line can (hide dot file) can be enough:
hide dot files = yes
guest ok = no

And now below I have shared a specific folder inside nas. As you can see I have set a valid user, after creating a User in the FreeNAS I will limit only cjones to logon to it.

[public]
comment = My Public share
path = /mnt/nas/public
public = no
writeable = yes
valid users = cjones
printable = no
#Old veto line that create problem with ‘icon’ named file for example
#veto files = /Network Trash Folder/Icon?/:2e*/.AppleDesktop/.AppleDB/.AppleDouble/TheFindByContentFolder/TheVolumeSettingsFolder/Temporary Items/.snap/
#This next line can (hide dot file) can be enough:
hide dot files = yes
guest ok = no

And we are done!

Just paste that into the config file at the end, wait a minute for Samba to reload the configuration!

4 Comments »

  1. Thanks for the info on the smb.conf file in FreeNAS, I played with it and it works!
    It only works as long as you don’t reboot the machine. It appears the only config file that truly gets written out is a config.xml file. I’m trying to find a way that would survive reboots, but I haven’t found out enough info on how FreeNAS (or monowall, since it is based on that) builds the /var/etc/smb.conf file when it boots. I am using the .684b version…btw the boot from cd and using a floppy to store the config.xml file works and is pretty neat!
    Thanks

    Comment by Jim Andrews — June 11, 2007 @ 3:46 pm

  2. Hey, I have a Freenas Server running like a charm. -edit the smb.conf file to allow for more share points and configured access permitions per user, works fine but with 1 huge problem:
    Every time the power dips, my client have to reconfigure the smb.conf file.

    Is there any way to write the smb.conf file to survive a reboot???

    Please help!

    Comment by David — July 4, 2007 @ 3:35 pm

  3. I have done a bit of investigation here. The smb.conf file is generated from the config.xml file at boot. The file is generated by the script at /etc/inc/services/inc

    If you search for “foreach ($config['mounts']['mount'] as $mountent)” you will see the code that generates the mount points.

    If have found that if you take the config.xml file onto another machine, edit it adding an extra mount into the mounts section (i.e. copy an existing one) then you can create antoher mount.

    In my example I created a new mount with a sharename of “share/dir”. This creates a share physicalley called “share/dir” that actually points to a directory on that mount point. Not ideal but the best available without modifying the generating file.

    If you are happy to modify the generating file and add an extra paratmer to the config.xml file then anything can be done, but that will take more time than I have at the moment.

    Good luck.

    Comment by Mat Ludlam — July 6, 2007 @ 9:29 pm

  4. And one more option: make a copy of your fine running smb.conf in someone of your mounted resources, and using the System/Advanced/Startup WebGUI’s menu, create a new command line like next:

    cp /mnt/anywhereUused/smb.conf /var/etc

    and define it as a “Post” executed command. This way, anytime your FREENAS server restart, yous smb.conf will be updated.

    PROBLEM: if you make changes with the Services/CIFS WebGUI’s menu , it’ll be overwrite with your (now) old smb.conf outsystem file… :-(

    Comment by Gui GonSe — July 19, 2007 @ 12:18 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.