nextcloud_ynh icon indicating copy to clipboard operation
nextcloud_ynh copied to clipboard

can't scan files

Open Thatoo opened this issue 2 years ago • 5 comments

Describe the bug

As root, if I launch

sudo -u nextcloud php /var/www/nextcloud/occ files:scan administrateur

I get the following error

Exception during scan: opendir(/home/administrateur/media/stockage): failed to open dir: Permission denied
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'opendir(/home/a...', '/var/www/nextcl...', 135, Array)
#1 /var/www/nextcloud/lib/private/Files/Storage/Local.php(135): opendir('/home/administr...')
#2 /var/www/nextcloud/lib/private/Files/Storage/Common.php(878): OC\Files\Storage\Local->opendir('media/stockage')
#3 [internal function]: OC\Files\Storage\Common->getDirectoryContent('media/stockage')
#4 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(408): iterator_to_array(Object(Generator))
#5 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('media/stockage', true, 3, 145787, true, 0)
#6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('media/stockage', true, 3, 145787, true)
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('media', true, 3, 145784, true)
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(340): OC\Files\Cache\Scanner->scanChildren('', true, 3, 33, true)
#9 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(259): OC\Files\Cache\Scanner->scan('', true, 3)
#10 /var/www/nextcloud/apps/files/lib/Command/Scan.php(156): OC\Files\Utils\Scanner->scan('/administrateur', true, NULL)
#11 /var/www/nextcloud/apps/files/lib/Command/Scan.php(212): OCA\Files\Command\Scan->scanFiles('administrateur', '/administrateur', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#12 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/nextcloud/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#19 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#20 {main}

I get the same for all users and if I launch for --all

Context

  • Hardware: Old laptop
  • YunoHost version: 4.2.8.3
  • I have access to my server: Through SSH | through the webadmin | direct access via keyboard / screen | ...
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no
    • If yes, please explain:
  • Using, or trying to install package version/branch:
  • If upgrading, current package version: can be found in the admin, or with yunohost app info $app_id

Steps to reproduce

As explained above

Expected behavior

Would like to scan all files of all users for keeweb to work...

Thatoo avatar Oct 27 '21 11:10 Thatoo

Hi!

As we can see, you have a permission problem with /home/administrateur/media/stockage, what this file is?

Can you do:

ls -la /home/administrateur/media/stockage

kay0u avatar Oct 29 '21 08:10 kay0u

ls -la /home/administrateur/media/stockage ou ls -la /home/OtherUser/media/stockage

give


total 32
drwx------ 5 admin root  4096 juin  14  2020 .
drwxr-xr-x 4 root  root  4096 août  17  2020 ..
drwx------ 2 admin root 16384 nov.  24  2018 lost+found
drwxr-x--- 2 admin root  4096 oct.  18 19:36 yunohost_backup_archives

Thatoo avatar Oct 29 '21 08:10 Thatoo

it is as if all /home/$USER/media were symlink to /media. I guess it's not a nextcloud issue but a yunohost thing. Is it normal situation?

Thatoo avatar Nov 06 '21 15:11 Thatoo

I believe that sudo -u nextcloud php /var/www/nextcloud/occ files:scan administrateur should not scan /home/administrateur folder but /home/yunohost.app/nextcloud/data.administrateur, no?

What do you think @kay0u ?

In /var/www/nextcloud/config/config.php, it is set 'datadirectory' => '/home/yunohost.app/nextcloud/data',

Thatoo avatar May 20 '22 07:05 Thatoo

@kay0u /home/administrateur/media/stockage Is my external hard drive where I store all Yunohost backup. Of course nextcloud should not scan these files. Do you know how to tell nextcloud to avoid scanning these files?

Thatoo avatar Jan 09 '23 08:01 Thatoo