Issue changing chown of a folder owned by nobody:nogroup. (NAS+Ubuntu LXD+Nextcloud)

Hello everyone!

On my Qnap Nas I have an Ubuntu LXD container to run. Inside the container I have installed Nextcloud. Everything runs smoothly but suddenly I recognized that one folder and his insides can’t be moved nor deleted.

I checked the ownership with ls -l and saw that the folder is owned by nobody:nogroup.

drwxr-xr-x  5 nobody   nogroup     4096 Nov 26 17:59  DELETE123

Tried to chown the folder back to www-data:www-data and did get this error:

root@ubuntu-nc:/path/to/files# chown www-data DELETE123
chown: changing ownership of 'DELETE123': Operation not permitted

I wanted to check the attribute of the folder. Maybe it is immutable? Did run lsattr.

root@ubuntu-nc:/path/to/files# lsattr
--------------e------- ./DELETE123

Seems ok right? I still tried to run chattr -a and chattr-i but again no luck.

root@ubuntu-nc:/path/to/files# chattr -a DELETE123
chattr: Permission denied while setting flags on DELETE123

I did further researches on the internet and it looks like that it could be related to “kernel ownership” or “mounted by host or NFS”. This is all new to me and I really don’t know how to go on and investigate more.

Thanks in advance.

You need to change the ownership from the host
for example:

  1. create a file under the ownership of www-data to find out the mapped uid
# inside guest
touch test
chown 33:0 test
  1. find out what the mapped uid/gid values are
# inside host
ls -lah /var/lib/lxd/storage-pools/<path to test file you just created>
-rwxr-xr-x 1 13065569 13065569   0 Nov  8 11:38 test
  1. Then change the ownership of the files/folders to whatever the mapped uid/gid is
# inside host
chown --recursive 13065569:13065569 /var/lib/lxd/storage-pools/<path to nextcloud data>
1 Like