1

I've been having problems with accessing files these days. In the course of solving this problem, I tried changing the ownership from root to ar.lnx and this is what I got

[ar.lnx@host DATA] $ cd /mnt/DATA
[ar.lnx@host DATA] $ ls -l
total 832
drwxr-xr-x  7 root root  32768 Jan 10 09:52 1
drwxr-xr-x 14 root root  32768 Jan 22 14:36 Audio
drwxr-xr-x  2 root root  32768 Jan 10 09:48 Compressed
drwxr-xr-x  4 root root  32768 Jan 22 19:22 Dev Workshop
drwxr-xr-x  3 root root  32768 Jan 10 11:40 ISO
drwxr-xr-x 11 root root  32768 Jan 17 12:10 Knowledge
drwxr-xr-x  3 root root  32768 Jan 11 01:30 Photos
drwxr-xr-x  2 root root  32768 Dec  3 20:24 print
-rwxr-xr-x  1 root root  40354 Jan 22 22:57 rpm-pack.catalog
-rwxr-xr-x  1 root root 335462 Jan 11 23:11 Solarized (dark).kateschema
drwxr-xr-x  4 root root  32768 Jan 11 00:53 Tattoo
-rwxr-xr-x  1 root root    320 Dec 26 15:53 network-list
-rwxr-xr-x  1 root root      2 Dec 26 15:53 network-list~
drwxr-xr-x  2 root root  32768 Jan 11 03:19 Windows(.exe)
[ar.lnx@host DATA] $ su
Password: 
[root@host DATA] # sudo chown ar.lnx:ar.lnx /mnt/DATA -R
chown: changing ownership of ‘/mnt/DATA/1/PP1-CS6-start.pdf’: Operation not permitted
chown: changing ownership of ‘/mnt/DATA/1/PP1-CS6-start1.odg’: Operation not permitted
.
.
.
chown: changing ownership of ‘/mnt/DATA/Audio’: Operation not permitted
chown: changing ownership of ‘/mnt/DATA’: Operation not permitted
[root@host DATA] #

why do I get "Operation not permitted?" and what exactly is the problem?

  • What does df /mnt/DATA show? I suspect you've mounted a CD-ROM or DVD-ROM. – Jeff Schaller Mar 1 '16 at 3:51
  • Or a storage device with read only permission , i remember sandisk have such issues – rɑːdʒɑ Mar 1 '16 at 3:59
  • @JeffSchaller Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 68643776 55656960 12986816 82% /mnt/DATA where is the issue ? – 0x0584 Mar 1 '16 at 4:04
  • Does sudo touch /mnt/DATA/1/test create a file? – techraf Mar 1 '16 at 4:26
  • 4
    is /mnt/DATA a FAT (i.e. windows or ms-dos) filesystem? FAT doesn't support file permissions or ownership. – cas Mar 1 '16 at 5:11
3

/mnt/DATA is likely a FAT (i.e. windows or ms-dos) filesystem, and FAT doesn't support unix file permissions or ownership. If not FAT, then some other fs type that doesn't support unix ownership or perms, but FAT is most likely.

You don't need to change the format unless ownership or perms are important to you - if you just want to transfer the files around using /mnt/DATA (presumably a USB stick) then you can just ignore the Operation not permitted error messages.

If owner/perms are important, then reformat as, e.g., ext4.

If you just want /mnt/DATA to be owned by a particular owner or group when mounted, then you can use the uid= and/or gid= mount options. You can also set the umask, dmask, and fmask values, which affect the default (faked/emulated) perms of created files and/or dirs.

See man mount and search for Mount options for fat for details.

  • that was really helpful, that you so much @cas – 0x0584 Mar 2 '16 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.