icewind1991 / files_inotify

Adds support detecting changes in local external storages with occ files_external:notify
29 stars 3 forks source link

Working great, but I have a question about how to handle different logins for the same share. #25

Open relink2013 opened 1 year ago

relink2013 commented 1 year ago

I have a SMB share that located on a Synology. For anyone familiar with Synology the user home folders are located at /homes/<username> but they are presented to the user as just /home.

So now to Nextcloud, I have and external storage that looks like this;

Folder Name: /
External Storage: SMB/CIFS
Authentication: Log-In credentials, save in database
Configureation:
    Host: 123.456.1.9
    Share: /home
    Remote Subfolder: 
    Domain:

This share is assigned to two different users, and each user sees 2 completely different things which is exactly how it should be. But how does this affect files_inotify since the SMB username and password still need to be provided when running occ files_external:notify.

I currently have 2 services setup to monitor that share, one for each user;

occ files_external:notify -v 8 -u thatguy -p pineapplebelongsonpizza123

occ files_external:notify -v 8 -u thewifeofthatguy -p pineappleisgross69

Is this the correct way to handle a share like this?

And what about multiple users on a normal share? Do I still need to run an individual command for each SMB account? Or can I just run the scan under a single user?

XTC-Desperado commented 1 year ago

sudo -u www-data php /var/www/nextcloud/occ files_external:notify --user GlobalServiceAcc --password thisisyourpassword 71 The last Number is the Mount ID

sudo -u www-data php occ files_external:list image

If you get "gencache_init: Failed to create directory: /var/www/.cache/samba - Permission denied" you should give the nextcloud-serviceaccount the permission (mostly www-data).

image On homedirectories you could get some "dead" directories, depends on what you do with old user-history (you should clean up sometimes, if not automated).

I´ve done it so far for now, but i still have to run different shares with a global serviceaccount to check if there is any change und the password should´nt be visible. If you have an idea to get this done with crone-jobs - please tell me - just too late today (worked hard totay to get it run, lack of knowledge and no detailed documentations so far. Have to try it self. Check this site: https://github.com/nextcloud/documentation/commit/32241b66935d135e1540c7e7beccbfdb0ed92323