chown: changing ownership not permitted, even though running as root
Solution 1
I don't think VFAT supports the type of permissions you're trying to set. In such case, the permissions are set the same for all files, when mounting the disk. Something like:
sudo mount -t vfat -o uid=piftp,gid=piftp /dev/sda1 /var/www
See also Can't change permission/ownership/group of external hard drive on Ubuntu here on Super User, or the external resource Connect your Raspberry Pi to a USB hard disk.
Solution 2
OP wrote:
I solved my ftp problem by mounting with
umask 0000
Related videos on Youtube
Marian Klühspies
Enthusiastic Software Developer. Started with Android Apps in 2013, moved to backend and frontend development and knows about Spring, Jakarta EE and Node.js. Looking for the easiest, most profitable ad solution for Android, iOS, Unity and so on? Appodeal It combines all major ad networks with just a single registration required and optimizes your profit!
Updated on September 18, 2022Comments
-
Marian Klühspies over 1 year
I managed to configure my Raspberry Pi as an FTP server with ProFTPD. The only problem is, I can´t upload and rename files and Windows Explorer says:
350 File or directory exists,ready for destination name
550 Rename xyz permission deniedNow I´ve read I have to
chown
this folder to the FTP user, but this does not work.I have tried:
sudo chown -R pi /var/www (my default pi account) sudo chown -R piftp /var/www (the ftp account) sudo su chown -R root /var/www
All I´m getting is
chown:changing ownership of ... : Operation not permitted
I already chmodded this directory to 777.
/var/www
is mounted from avfat
volume on my external hard disc. Looking at it withls -l
I see all files and folders have ownerroot
and grouproot
and all of these folders have permissionsdrwxr-xr-x
.Can someone please help?
-
Ramhound about 10 yearsWhat is the current owner of the folder?
-
Marian Klühspies about 10 yearsThe owner of www is pi
-
Ramhound about 10 yearsAre you able to sudo other commands that normally require it. Its almost like the
root
doesn't even exist. -
Marian Klühspies about 10 yearsyes I am, I was also able to change the root password
-
Arjan about 10 yearsWhat does
ls -l
give for the failing file or folder? And your "All I'm getting is chown:changing ownership of ... : Operation not permitted" applies to all files and folders, right? Or do some succeed? If some do succeed, is the file or folder that is failing any special? Like maybe that is a file that has been uploaded by Windows Explorer with some temporary name? -
Arjan about 10 yearsWhich OS are you running on your Raspberry Pi? And what file system? (For that
/var/www
folder.) And maybe specifying the group is required in thechown
command too? -
Marian Klühspies about 10 yearsls -l gives me root root for all folders/files. if I´m root, im not getting the permission error. the rights of these folders are drwxr-xr-x. I´m running raspbian, the file system of my external hdd which is mounted in /var/www is vfat. No it´s no file or folder from windows explorer as the upload is not permitted :(
-
Arjan about 10 yearsI've rolled back your edit; please note we're not a forum. (That's not different from Stack Overflow, which you've used a lot.) If you have additional questions, then post a new question for that. Of course, first search, as it might have been asked before.
-
Arjan about 10 yearspossible duplicate of Can't change permission/ownership/group of external hard drive on Ubuntu
-
Ramhound about 10 yearsI am going to have to roll back this question myself also. If you have resolved it yourself post an answer, don't post the solution in the question, thats not how this website works.
-
-
Marian Klühspies about 10 yearsno effect at all, tried everything of those examples
-
Arjan about 10 yearsSurely the output of
ls -l
must be different when you mount the drive like above, @Nachbar90? -
Marian Klühspies about 10 yearsthe output for the mounted hdd is drwxr-xr-x 15 piftp piftp
-
Arjan about 10 yearsSounds like me that your "chown: changing ownership not permitted" has been answered then?
-
Marian Klühspies about 10 yearsyes but not my real problem. The hdd is mounted as read only I think. The command for mounting it as rw is just giving me the mount infotable
-
Arjan about 10 yearsSee my comment to your question, about the rollback. And please read superuser.com/about Success!
-
Marian Klühspies about 10 yearsNow I´m as wise as before. Still no chance to get my ftp working
-
Arjan about 10 yearsThen just go ahead and ask another question about that (if it has not been asked before). Your own title for this question was "chown: changing ownership not permitted". By now you know that this was related to using an external drive, and how to set the ownership for external drives, so make sure you add that information to any new question you ask. Don't ask chameleon questions please. Success!