Override Samba Permissions

Yellowdart
Posts: 3
Joined: Tue Aug 09, 2011 7:06 am

Override Samba Permissions

Postby Yellowdart » Tue Aug 09, 2011 7:20 am

I have a share that I created using the Amahi dashboard called Gallery3. It is part of my greyhole pool with multiple duplication. For (hopefully) obvious reasons, I would like to keep this share in the pool so that as users upload their photos to my Gallery3 site, the photos will be backed up to multiple hard drives.

I have figured out how to move the 'var' directory from the /var/hda/web-apps/gallery3/html directory to wherever I want using a symbolic link in the mentioned directory to wherever I move the files. This works great when I move it to another non-pool drive or if I move it directly to /var/hda/files/<someshare>. The problem is, everything I have read indicates that we should not be writing directly to the /var/hda/files/* folder, but rather to the locally mounted samba shares.

I have gotten the samba shares to successfully mount locally using the provided script; I have configured the Gallery3 var folder to point to the Gallery3 share I created in the Amahi dashboard; however, Gallery3 does not work because it requires 777 permissions on this share and the Amahi share does not have this.

I have tried chmod'ing the /mnt/samba/Gallery3 folder, but it immediately reverts (or perhaps never changes). I have tried to chown to apache (since this is the gallery3 default), but with the same result (no change). After attempting both of these, I have guessed that samba must be controlling permissions ...

I tried adding parameters to the share (using the Amahi dashboard interface) such as create mask = 0777 and directory mask 0777 (and so on); however, I've noticed that while these are added successfully to the smb.conf file - they do not replace the existing entries (they are just listed after) and they do not change the actual functionality of the shares.

I am sure I am missing something simple, but I have run out of ideas on my own. Any help would be appreciated.

If it is helpful, here is the Gallery3 portion of my smb.conf file as it stands (I have removed the Amahi dashboard parameters):
[Gallery3]
comment = Gallery3
path = /var/hda/files/Gallery3
writeable = yes
browseable = yes
create mask = 0775
force create mode = 0664
directory mask = 0775
force directory mode = 0775

dfree command = /usr/bin/greyhole-dfree
vfs objects = greyhole

Thank You

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Override Samba Permissions

Postby bigfoot65 » Tue Aug 09, 2011 9:16 am

Did you try chmod 777 /var/hda/files/Gallery3? Do it this way versus the /mnt/samba/Gallery3 folder. That will make the share 777 and you can do the ownership the same way.

Samba should see it as 777 and whatever ownership you declare.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

Yellowdart
Posts: 3
Joined: Tue Aug 09, 2011 7:06 am

Re: Override Samba Permissions

Postby Yellowdart » Tue Aug 09, 2011 11:55 am

Thank you for the quick response! I have to admit as a former WHS user, having recently migrated to Amahi, I am really impressed with the community here.

Here's what I've done (as super-user):

Code: Select all

chmod -R 777 /var/hda/files/Gallery3 chown -R apache:users /var/hda/files/Gallery3
I checked the permissions and whether or not Gallery was working. Nothing seemed to have changed. I re-added the samba parameters to the Amahi Dashboard, e.g.

Code: Select all

create mask = 0777 force create mode = 0777 directory mask = 0777 force directory mode = 0777
Now my smb.conf file looks like this:

Code: Select all

[Gallery3] comment = Gallery3 path = /var/hda/files/Gallery3 writeable = yes browseable = yes create mask = 0775 force create mode = 0664 directory mask = 0775 force directory mode = 0775 create mask = 0777 force create mode = 0777 directory mask = 0777 force directory mode = 0777 dfree command = /usr/bin/greyhole-dfree vfs objects = greyhole
I realize that there is an obvious problem with the duplicate entries (as mentioned in my first post, my overridden parameters don't actually overwrite but simply add to the end), but I am hoping that since the ones I added are later in the file, they will override the earlier ones and not cause any long-term problems. After changing this and restarting samba, there was still no change. Then I tried a full system reboot (with all of the above settings). I decided the reboot was necessary to ensure that everything got reloaded (in case I missed something just restarting samba). Even after the reboot, the permissions are still not right and the Gallery3 site still doesn't work.

Any additional help that can be offered will be greatly appreciated.

Yellowdart
Posts: 3
Joined: Tue Aug 09, 2011 7:06 am

Re: Override Samba Permissions

Postby Yellowdart » Wed Aug 10, 2011 7:47 am

Ok ... I discovered the source of my problem. I don't have a full solution yet, but hopefully the following will help someone in a similar situation.

The problem I was having was due to the 'mount_shares_locally' script. This is a fantastic script that I found for mounting the Amahi created shares automatically on boot. It starts in init.d and handles newly created shares and does a wonderful job. However, the mount.cifs command that is issued explicitly sets the samba permissions as file_mode=0660 and dir_mode=0770. What this means is that even though I had changed my permissions in /var/hda/files/Gallery3 and provided the samba options to the Amahi interface, my mounted shares would not exceed these permissions.

I ran a test by mounting my Gallery3 location with the file_mode and dir_mode settings changed to 0777 and everything started working! However, I don't want to leave things this way because I don't want all of the shares mounted 777. I know that the permissions would still be limited to the permissions set by the file system since samba doesn't override those, but it feels sloppy to do things that way when I only need the one directory at the 777 level. My ultimate plan is to modify the mount_shares_locally script to include something like an if statement that checks if the share being mounted is my Gallery3 share, and if so to use an alternate mounting command.

Anyway, hopefully that will save someone some the research headache that I just went through. I am sure most of this is my own fault for having such a strange setup, but I wanted to ensure that my Gallery3 photos would be stored the same place everything else is and have the benefits of duplication. It would also probably help if I wasn't such a linux noob, but I guess with so many people like me coming from WHS there are plenty of us to go around. Thanks to the gurus for your patience with us.

Who is online

Users browsing this forum: No registered users and 20 guests