How to modify the permissions of uploaded pictures?

Hello guys.I’m running nextcloud use docker-compose, and mount two USB disks to datafolder:

version: '2'

volumes:
  db:

services:
  db:
    image: mariadb:10
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=true
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=root

  app:
    image: nextcloud:latest
    restart: always
    ports:
      - 5885:80
    links:
      - db
    volumes:
      - /data/next-cloud:/var/www/html
      - /mnt/Nas:/var/Storage/Nas
      - /mnt/Nas1:/var/Storage/Nas1
    environment:
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=root
      - MYSQL_HOST=db

image

Everything works fine,both owner and group of files which inside datafolder is http,seems that user&group http was automatically created by docker.
I found that the file permissions uploaded through nextcloud client are -rw-r--r--,I want it to be -rw-rwxr-- by default, so that I can add other user to group http,then I can use this user to modify it.
But I didn’t find a solution, currently I have to use chown or chmod to change permission, do I need to configure it in config.php?

That is not a good idea. If another user upload or change files Nextcloud does not recognize it. You must always use occ files:scan --all to update Nextcloud database. documentation
And if you do want to include files, use the root user and then change the permissions of the files to the Nextcloud user defaults. Then run occ files:scan --all.

Also you can use for upload files WebDAV with a Nextcloud user. Maybe it solves also your problem. documentation

2 Likes

Thanks!
I use nextcloud just to expose my files to WLAN,not entirely dependent on it.I have some scripts which listen my files, like auto change filename after image uploaded, because I’m running nextcloud inside docker,so I can’t use the workflow app to do that.
I have found Allow the UID/GID to be changed · Issue #359 · nextcloud/docker · GitHub, it solved my question exactly.Now,the problem is

I have no idea to refresh nextcloud automatically after my script execute.

You can add in your script a command to execute the php occ files:scan --all in Docker and for the correct user. Or you can e.g. use CRON.

Maybe you can use the external storage best is Local to solve your program. Then copy only files to this part of your Nextcloud.

For only show files in the browser i like the software Tiny File Manager. Here is an example for the folder Images. The software is only one single php file.