Ubuntu Server permissions issues

This will hopefully be some low hanging fruit for someone. I am almost a NOOB but I do have some skills. This issue has me stumped. I am simply trying to manually update my instance of nextcloud. I need to copy the new files to my existing /var/www/html folder.

bigdaddy@ubuntu_lamp:/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud$ ls -al
total 270
drwxrwxr-x 13 www-data www-data    27 May  3 14:51 .
drwxrwx---  3 www-data www-data     3 May  3 15:39 ..
-rwxrwxrwx  1 bigdaddy www-data  2537 Apr 22 19:23 .htaccess
-rwxrwxrwx  1 bigdaddy www-data   101 Apr 22 19:23 .user.ini
d-wx-wx--- 33 www-data www-data    40 May  3 14:51 3rdparty
-rwxrwxrwx  1 bigdaddy www-data 15752 Apr 22 19:23 AUTHORS
-rwxrwxrwx  1 bigdaddy www-data 34520 Apr 22 19:23 COPYING
d-wx-wx--- 43 www-data www-data    43 May  3 14:22 apps
d-wx-wx---  2 www-data www-data     5 May  3 14:26 config
-rwxrwxrwx  1 bigdaddy www-data  3910 Apr 22 19:23 console.php
d-wx-wx--- 23 www-data www-data    29 May  3 14:26 core
-rwxrwxrwx  1 bigdaddy www-data  5048 Apr 22 19:24 cron.php
-rwxrwxrwx  1 bigdaddy www-data   156 Apr 22 19:24 index.html
-rwxrwxrwx  1 bigdaddy www-data  2976 Apr 22 19:24 index.php
d-wx-wx---  6 www-data www-data     9 May  3 14:32 lib
-rwxrwxrwx  1 bigdaddy www-data   283 Apr 22 19:24 occ
d-wx-wx---  2 www-data www-data     3 May  3 15:39 ocm-provider
d-wx-wx---  2 www-data www-data     5 May  3 14:20 ocs
d-wx-wx---  2 www-data www-data     3 May  3 14:20 ocs-provider
-rwxrwxrwx  1 bigdaddy www-data  3056 Apr 22 19:24 public.php
-rwxrwxrwx  1 bigdaddy www-data  5235 Apr 22 19:24 remote.php
d-wx-wx---  4 www-data www-data     8 May  3 15:39 resources
-rwxrwxrwx  1 bigdaddy www-data    26 Apr 22 19:24 robots.txt
-rwxrwxrwx  1 bigdaddy www-data  2381 Apr 22 19:24 status.php
d-wx-wx---  3 www-data www-data     4 May  3 14:26 themes
d-wx-wx---  2 www-data www-data     4 May  3 14:26 updater
-rwxrwxrwx  1 bigdaddy www-data   362 Apr 22 19:29 version.php

I am finding it impossible to change the permissions or owner of the directories above. www-data uid = 33, www-data gid=33, bigdaddy uid=1000, bigdaddy gid=1000 and www-data and bigdaddy are members of each group.

When I try the command below I get an error.

bigdaddy@ubuntu_lamp:/mnt/NextCloud/updater-ocrk95mdq67l/downloads$ chmod -Rv g+r /mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib/
chmod: changing permissions of '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib/': Operation not permitted
failed to change mode of '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib/' from 0330 (-wx-wx---) to 0370 (-wxrwx---)
chmod: cannot read directory '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib/': Permission denied
failed to change mode of '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib/' from 0330 (-wx-wx---) to 0370 (-wxrwx---)

I am at a loss as to what I am doing wrong. The /mnt/NextCloud folder is mounted from a freenas folder. The line in the fstab folder is below.

192.168.1.142:/mnt/BigdaddyZFS/NextCloud /mnt/NextCloud nfs auto,rw,exec

I would sincerely appreciate any help someone might be able to give. Everytime I think I understand permissions I seem to get stumped. Thanks so much in advance.

I’m confused as to why you need to chmod. Typically you would use sudo cp to copy the files with administrative rights. The files should come w/ correct permissions unless you downloaded them in winblows or something odd like that.

After the files are copied you may need to use sudo chown to give the webserver ownership of the files/directories.

If I try to copy I get the following error.

sudo cp /mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/. /var/www/html

cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/.': Permission denied

Interesting, how about sudo cp -r /mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/* /var/www/html/ ?

I had tried -r earlier. I knew I needed it.

sudo cp -r /mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/* /var/www/html/

cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/3rdparty': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/AUTHORS': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/COPYING': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/apps': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/config': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/console.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/core': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/cron.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/index.html': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/index.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/lib': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/occ': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/ocm-provider': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/ocs': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/ocs-provider': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/public.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/remote.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/resources': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/robots.txt': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/status.php': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/themes': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/updater': Permission denied
cp: cannot stat '/mnt/NextCloud/updater-ocrk95mdq67l/downloads/nextcloud/version.php': Permission denied

Maybe something here will help: https://serverfault.com/questions/65048/permission-denied-for-user-with-sudo-privileges

Apologies if you’ve already looked at the above.

I went through this one recently. NFS and permissions are strange at best. Any chance you can ssh directly into that box and change permissions on the machine that serves NFS? I wish I found another solution, but that’s what I did recently in a very similar situation. Some ID remaps are problematic and I hope someone else can point to why.