chown command returning Operation not permitted
The reason is because the ownership and permissions are defined at mount time for the vfat
FS.
Manual page mount(8):
Mount options for fat ..
uid=value and gid=value Set the owner and group of all files. (Default: the uid and gid of the current process.) umask=value Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.
There are at least three things you can do:
(1) Give pi:pi
access to the entire /media/USBHDD1 mount:
mount -o remount,gid=<pi's gid>,uid=<pi's uid> /media/USBHDD1
To determine pi's uid:
cat /etc/passwd |grep pi
To determine pi's gid:
cat /etc/group |grep pi
(2) Give everyone access to /media/USBHDD1
by changing the umask
and dmask
(not recommended):
mount -o remount,umask=000,dmask=000 /media/USBHDD1
(3) Change the partition to a different file system. Only do this if you're not accessing the the external hard drive from a windows computer:
You won't be able to convert the file system from VFAT to a Unix-compatible FS, so you'll have to backup the contents of the drive, format as EXT3+ or reiserfs, then copy the contents back. You can find tutorials for doing this on the web.
l00kitsjake
Updated on August 07, 2020Comments
-
l00kitsjake almost 4 years
I am working on a raspberry pi and am having a tough time giving permissions to an external hard drive that I have mounted using the following tutorial:
http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/
I have now created folders on that external hard drive and when I do a
ls -l
command I get the following returned:drwxr-xr-x 2 root root 512 Aug 28 23:24 test
That is located in:
/media/USBHDD1/shares
Now I'm trying to give it all write read and execute permissions or even change the owner and group to pi:pi
However,
chmod 777
is not working – it doesn't return an error, just seems to have no effectAnd when I use
sudo chown -R pi:pi test/
I get the error
chown: changing ownership of `test/': Operation not permitted
This is a linux question but I think someone with background and knowledge of using a raspberry pi can help me out here.
Extra info as requested:
When I run
pi@raspberrypi /media $ grep USBHDD1 /etc/mtab
it returns:/dev/sda1 /media/USBHDD1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
-
mstrthealias almost 10 yearsLooks like
/media/USBHDD1
is a NTFS or VFAT partition which has the user/group ownership configured at mount time. -
wildplasser almost 10 yearsEither that, or it is mounted read-only. To the OP: what is the mountpoint? (
/media/USBHDD1/shares/
or/media/USBHDD1/
? ) and What is thepwd
when issuing the chmod command ? -
mstrthealias almost 10 yearsInclude the output of
grep USBHDD1 /etc/mtab
in your question. -
l00kitsjake almost 10 years@wildplasser I believe the mountpoint is /media/USBHDD1/shares and Im not prompted for a password when using chmod. Any command I use 'sudo' in, Im never prompted for a password
-
wildplasser almost 10 yearsVFAT ist is. @myninjaname was right. VFAT does not support ownership.
-
l00kitsjake almost 10 years@wildplasser how can I change this to not be VFAT then? Is that a possible solution?
-
-
mstrthealias almost 10 yearsLet us continue this discussion in chat.