file permissions when uploading

Ask all your questions regarding OC 8.0 and 8.1 Please read the Support Forum Rules
Forum rules
The forums were migrated over to https://central.owncloud.org which is based on the forum software Discourse. The forums here is put into read-only mode starting from today.

More background information about this move and the reasoning behind it is available in this blogpost:

https://daniel.molkentin.net/2016/07/20 ... d-central/
johnomaz
Newbie
Posts: 3
Joined: Sun Apr 17, 2016 12:55 am

file permissions when uploading

Postby johnomaz » Sun Apr 17, 2016 1:03 am

Ok so I mount an ext4 partition from my NAS to /var/www/owncloud/data so all files I upload go to a 500gb partition on my NAS. I copied all files including the hidden ones to the mounted data location and ran chown -R www-data:www-data data to ensure www-data is the owner of all the files.

I log into my admin account just fine. I get no permission problem messages or anything. The issue comes when I try to upload a new file. I get an error saying "Upload failed. Cannot find the uploaded file". But if I refresh the page, it shows up. I however cannot access it, delete it or anything. If I check the permissions with la -al I see the any new file that uploads has root:root as the owner. If I chown the file, I can do whatever I want with it after that.

My question is...why is any uploaded file saving as root? The entire partition on my NAS drive has been set to www-data:www-data as the owner.

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: file permissions when uploading

Postby RealRancor » Sun Apr 17, 2016 1:07 am

Hi,

you shouldn't mess around in the datadir manually. This is unsupported and documented at various places:

viewtopic.php?f=17&t=32183

If files uploaded via oC have the owner "root" then your webserver/php process is running as root. And that is REALLY bad.
*gone*

johnomaz
Newbie
Posts: 3
Joined: Sun Apr 17, 2016 12:55 am

Re: file permissions when uploading

Postby johnomaz » Sun Apr 17, 2016 1:13 am

RealRancor wrote:Hi,

you shouldn't mess around in the datadir manually. This is unsupported and documented at various places:

viewtopic.php?f=17&t=32183

If files uploaded via oC have the owner "root" then your webserver/php process is running as root. And that is REALLY bad.


I removed the mount, moved the original data folder back in place and everythign works fine. my webserver doesn't run as root, thats just it. thats why its confusing me. it does run as www-data

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: file permissions when uploading

Postby RealRancor » Sun Apr 17, 2016 1:21 am

You can also do such permission / ownership stuff during mount time. Maybe:

man mount

could give you some additional pointers.
*gone*

johnomaz
Newbie
Posts: 3
Joined: Sun Apr 17, 2016 12:55 am

Re: file permissions when uploading

Postby johnomaz » Sun Apr 17, 2016 1:35 am

RealRancor wrote:You can also do such permission / ownership stuff during mount time. Maybe:

man mount

could give you some additional pointers.


I've been trying to mount with permissions and they refuse to work. Was using uid=33 and gid=33 (33 is my accounts value) and it never works.

I've been trying that but I have a feeling its how my NAS is set up that may be the issue. I have a 2TB USB3 external drive plugged into my Netgear N7000 Nighthawk router running DD-WRT firmware. Its worked for everything so far and I've been happy. But for OwnCloud, you need to be able to set permissions and the 2TB drive is an NTFS drive. So I shrunk the NTFS partition, created a 500gb EXT4 partition and mounted that on my router. I can access the partition just fine, it can set permissions just fine so the EXT4 table is fine. but for some reason any time I write a file to the mount, it writes as root. using the default data location for OwnCloud, the files write correctly and everything. I guess for now, my 64gig micro sd card in my RaspberryPi is more than enough storage space, I just wanted to expand the storage to my wife. I guess I'll set the limits for us to 20GB each and be happy for now. its more than both our Dropbox accoutns combined anyways.

[[edit]]

I rummaged around and found a relatively new 250gb 2.5" HD in my hobby room and put it in an external enclosure. Formatted it, mounted it and changed the config.php file to point to the new mount location, copied the data folder over, reset owner and it all works correctly. It had to be the way I was mounting the NAS drive through my router. Oh well, learn something new every day.


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Server 8.0 and 8.1”

Who is online

Users browsing this forum: No registered users and 2 guests