Changes

From Amahi Wiki
Jump to: navigation, search
2,176 bytes added ,  10:45, 29 November 2010
Created page with "Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed thr..."
Mounting your Samba shares locally is useful when you are using Greyhole, and want to write or in any way work with those files locally. Greyhole data should only be accessed through shares, so mounting those shares locally is an easy way to work with Greyhole data safely.

* Add each share you want to mount locally to your /etc/fstab, like this:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
#smb#//127.0.0.1/<share_name> /mnt/samba/<share_name> cifs credentials=/home/<username>/.smb_credentials,uid=500,gid=100,file_mode=0660,dir_mode=0770,hard,_netdev 0 0
</div>
You'll need to replace ''<share_name>'' with the actual share name.<br/>
And ''<username>'' with your username. That user will own all the files in the mounted shares, though all users that are part of the ''users'' group (gid=100) will also be able to write in those mounted shares.

* Create the ''/home/<username>/.smb_credentials'' file. This is a simple text file (use your favorite text editor).
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
username=<your_username>
password=<your_password>
domain=HOME
</div>

* Manually create the /mnt/samba/<share_name> directory.

* Finally, add the following lines in /etc/rc.local:
<div style="border: 1px solid #A3B1BF; padding: .5em 1em; color: #000; background-color: #E6F2FF; margin: 3px 3px 1em 3px;">
# Mount own Samba shares locally
/bin/sed -ie 's/#smb#//g' /etc/fstab
/bin/mount -a
/bin/sed -ie 's@//127.0.0.1@#smb#//127.0.0.1@g' /etc/fstab
</div>

To test your new mounts, you can execute the commands you added in rc.local.<br/>
rc.local is executed on boot, after all other services have been started.<br/>
This is necessary because mounts found in fstab are mounted before the Samba service starts, so just having your shares in fstab is not enough. The commands added in rc.local will un-comment your share lines from fstab, then mount them all, then re-comment them again, so that when fstab is executed on boot, it doesn't give you errors about those shares not being available.