Move DATA folder to a network folder


I’m new on this forum, but I’m using nextcloud from many years now

Today, I’m updating my servers and would like to move DATA folder on my NAS

nextcloud is running on a debian 10 server
I alredy mount NAS folder on nextcloud server, I can move (or copy) DATA folder, but cannot use it because when I copy it, owner chage from www-data to root

I cannot change owner to www-data

If I copy DATA folder everywhere on nextcloud server, I can do it, but cannot change owner on a mounted folder

what is the solution to fix it?

Many thanks for your lights

Please post more details? Is NAS a NFS or SMB folder? Perhaps you have mounted it not correctly. Post linux shell commands and outputs.

following linux command to mount folder :

mount -t cifs -o username=*****,password=**** // /media/nextcloud/data/

of course, I replaced login and folder with ***

I can use mounted folder , copy file, read file, write in a file from linux server, but cannot change right and owner, so, webserver (nextcloud) cannot.

It is a SMB folder

Let me know if you need more info

did I do something wrong?

I think the problem is the fact that is not really a SMB share or a network folder. It is a “mount -t cifs”. Perhaps you can better use SMB not as primary but as secondary data.

Another possiblity is o use e.g. NFS mounted data.

how could I do that?

yes it is :

mount -t cifs -o username=*****,password=**** // /media/nextcloud/data/

how could I do a really SMB mount?

It is a “really SMB mount”. But i think you mounted it for system user and not for nextcloud user. Perhaps you can change the mount - command if you like or meed SMB.