Open wildernessfamily opened 1 year ago
Hi,
I'm very glad that you find this project useful :)
Regarding your feature request, let me first confirm if I understand it correctly:
www-data
; the same server also serves files as user david123
via SSH;www-data
because they have user/group david123
. Therefore, the Nextcloud web server cannot access them;nextcloud-inotifyscan
as root
so that it not only adds files to the Nextcloud database, but also updates the user and group so that the web server can access them as www-data
.I think this is a valid and probably very common use case, but I wouldn't recommend your solution, for two reasons: 1) updating user/group is not intended usage of nextcloud-inotifyscan
, especially given the fact that it requires privileges, and 2) there is a simpler and (arguably) better solution. In fact, I have exactly the same use cases and have been using the following solution for years, but never was able to document it anywhere. This might be a good time to do it. The idea is to attack the fact that
Files uploaded via SSH/SSHFS is not accessible by
www-data
because they have user/groupdavid123
.
This is doable using ACL to make new files and directories inherit group from their parent directory. Step-by-step example:
family
;usermod -a -G family www-data; usermod -a -G family david123
;chgrp family -R /path/to/shared/dir/
;chmod g+w /path/to/shared/dir/
;chmod g+s /path/to/shared/dir/
;setfacl -dm g::rwx /path/to/shared/dir/
.New files and directories under /path/to/shared/dir/
will now have group family
even if they are created by the www-data
user via Nextcloud or by the david123
user via SSH. Both users are able to read & write files owned by group family
, too. New subdirectories will inherit the same property. Existing files and directories will need to be updated in a similar way as /path/to/shared/dir/
, possibly with the help of find -type d/f -exec
.
Hi, I've been using iNotifyScan for some time. It works flawlessly. It's amazing! I switched from using SAMBA to SSHFS. I don't want all my users (family members) using the same SSH key for user
www-data
. Example, lets say my SSH username isdavid123
. When I create the SSHFS mount to my NextCloud files and I transfer files they are written as userdavid123
and groupdavid123
. iNotifyScan picks up the files and adds them to NextCloud database but in I can't access them in NextCloud UI. I get permission denied due to the user/group naming. When using iNotifyScan, is there a possibility to be able to update the user/group of all of the scanned files for any and all users towww-data:www-data
during the scan?Thank you for your time and hard work creating iNotifyScan. Very much appreciated!