SOLVED: Mount share locally apache

modem7
Posts: 204
Joined: Tue Mar 20, 2012 6:00 pm

SOLVED: Mount share locally apache

Postby modem7 » Sun Nov 11, 2018 4:32 pm

Hey guys,

In the wiki guidance, it states under "Revise mount_shares_locally":
Since Greyhole uses Samba as a layer between the user and itself we would like to keep our writes and deletes to the shares and not the actual landing zone. But since apps (most of them) run as the user apache it will not be able to access /mnt/samba, which is the default mount point if you set up mount_shares_locally. This following script retains the function of the original script but also adds a second mount point under /mnt/apache where the apache user will have read and write access. I have kept it simple and it will use the same credentials as the main mount. So only shares available to that user will be available for apache.

By doing this apache will now have a place where it is allowed to read and write files to your shares and SickBeard can thus be configured to place the new episode in /mnt/apache/TV which is then instantly picked up by Greyhole and file copies distributed to the discs in your pool as configured.

Note that this script is based of the Greyhole original one and uses /etc/samba/smb.conf as the source of your shares and does not load the shares from the database like the old HDA version of the script did. If that behaviour is desired that can be easily added by replacing the lines

testparm -s /etc/samba/smb.conf 2>/dev/null | grep "^\[" | grep -v "\[global\]" | grep -v "\[homes\]" | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d "\n" mkdir -p

with

mysql -u root -p -e "select comment from shares" hda_production | grep -v "^comment$" | xargs -d "\n" mkdir -p
It seems that the change "mysql -u root -p -e "select comment from shares" hda_production | grep -v "^comment$" | xargs -d "\n" mkdir -p" has already been done.

I'm not quite sure how to best proceed if I want my apache things to be running as expected.

Note: I've set my sab directory to /mnt/samba/Downloads/

But I'm (understandably) getting the errors:

2018-11-11 23:34:09,228 ERROR: Cannot change permissions of /mnt/samba/Downloads/_UNPACK_<file>.mp4
2018-11-11 23:34:09,226 ERROR: Cannot change permissions of /mnt/samba/Downloads/_UNPACK_<folder>

Any ideas?

Thanks!
Last edited by modem7 on Wed Nov 14, 2018 5:59 pm, edited 2 times in total.

madhatta
Posts: 28
Joined: Tue Oct 09, 2018 8:56 pm

Re: Mount share locally apache

Postby madhatta » Tue Nov 13, 2018 9:58 am

What I did was just added users that needed rwx on the locally mounted shares to the users group. Then you don't need a different locally mounted share instantiated for each user:

first run "groups <account_name>"

if it's not listed in the users group then

usermod -a -G users <account_name>

You may want to see if there is a username "sickbeard" (groups sickbeard) created by Sickbeard and if so add it to the users group and restart the service.

As long as your shares are set to permissions 775 (which I think is default when setting up samba shares through the Amahi interface) the account (now in the users group along with your 1stadminuser) should be able to do what it needs to do. Rinse and repeat for any other app accounts you need to be able to directly modify things within the locally mounted shares.

Edit: Oh and I still experience those errors in Sabnzbd, btw. I believe it is because it is trying to change the permissions of the files when it doesn't need to. Everything works as expected with moving files and deleting things as the account SabNZBd has been added to the users group and as such has read/write/execute access.

Check out my post from a few weeks ago and that may offer some help too.

viewtopic.php?f=4&t=7177

modem7
Posts: 204
Joined: Tue Mar 20, 2012 6:00 pm

Re: Mount share locally apache

Postby modem7 » Tue Nov 13, 2018 10:16 am

Would the new locally mounted shares also need to be set to 775?

The default script seems to default to file 660 and folder 770.

Code: Select all

.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,

madhatta
Posts: 28
Joined: Tue Oct 09, 2018 8:56 pm

Re: Mount share locally apache

Postby madhatta » Wed Nov 14, 2018 6:49 am

Would the new locally mounted shares also need to be set to 775?

The default script seems to default to file 660 and folder 770.

Code: Select all

.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,
hmmm I am relooking at that part of the script but I have not needed to change anything there. I would just start it up and then go look at the created shares and see what the persmissions are that have been applied. But just to clarify, that is exactly the line I have in my script and my locally mounted shares have the same permissions as was set in the smb.conf by amahi when they were created... 775.

Seems like you could edit those items (even to 777) for testing purposes but I would try it with minimal incremental changes first.

Hope that helps.

modem7
Posts: 204
Joined: Tue Mar 20, 2012 6:00 pm

Re: Mount share locally apache

Postby modem7 » Wed Nov 14, 2018 1:51 pm

Weird, it all seems to work now for some weird reason.

Well, the way I see it, if it works, don't question it!

Thank you for the help!

madhatta
Posts: 28
Joined: Tue Oct 09, 2018 8:56 pm

Re: Mount share locally apache

Postby madhatta » Thu Nov 15, 2018 11:23 am

Weird, it all seems to work now for some weird reason.

Well, the way I see it, if it works, don't question it!

Thank you for the help!
No problem. Looking over your new post now.

Who is online

Users browsing this forum: No registered users and 1 guest