Linux unable to chown. Dec 7, 2023 · In this tutorial, we saw how to resolve the Operation not permitted error on a Linux system. A forum for discussion and discovery for using VMs, Containers, and related tools on Chrome OS & Chromium. This is because of how getopt_long() works. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place! May 5, 2013 · That is: chown foo:bar some/location -R chown -R foo:bar some/location both work. Since using chown requires owning the file or being root (users can never appropriate other users' files), only root can run chown to change a file's owner to another user. Jul 30, 2023 · chown doesn’t work as you expect if the filesystem is FAT or NTFS. chown foo:bar some/location -- -R would look for directory named -R. The string text for EPERM is "Operation not permitted" and it's what you get when you try to do things as a regular user that need root and can't be granted by file permissions. As explained here (thanks @slhck): Only processes with an effective user ID equal to the user ID of the file or with appropriate privileges may change the ownership of a file. bashrc : Permission denied Even after (as root) I've run chown -hR nroach44 /h Jul 4, 2012 · Linux - Newbie This Linux forum is for members that are new to Linux. If root owns those files, you'll need to chown them properly, before you can change their permissions: Then as the owner you can change their permissions: Jul 23, 2025 · Conclusion The chown command in Linux modifies files and their ownership lists. To use chown, a user must have the privileges of the target user. In these cases the ownership is set by the way you mount the partition, either in fstab or by the mount command used Jun 16, 2025 · Whether you’re a DevOps engineer, sysadmin, or just diving into Linux, this guide will walk you through everything you need to know — from the basics to real-world applications — all in a clean, accessible format. In my book this is a bug – as it should either result in error, or be documented, which from what I can find it is not. We went through various scenarios in which this error can occur while trying to use the chown command to change the ownership of a file in Linux. Jul 10, 2015 · I am trying to change that to root but I get the following chown: cannot read directory ‘databases/’: Permission denied. ls -al is not showing you who owns the file, just its permissions. This common error occurs when you try to change the ownership of a file or directory, and it can be caused by a variety of factors. I thought it would have been possible with: sudo chown user:user. The only other case where EPERM is used to mean not possible is trying to create a hard link to a directory Somehow, I managed to chmod and chown my ~ into oblivion. I get the following message: chown: changing ownership of `ps': Operation not permitted May 10, 2022 · @marcelm: Actually no. This is the command I sudo chown -R root databases/ and this is the permission of the folder: drwxrwx--x 36 nobody nobody 4096 Jul 9 08:10 databases How can change the ownership? Sep 17, 2015 · I am trying to help a user solve an issue with a bootable USB drive, but there seems to be a file whose ownership cannot be edited. Learn fixes for sudo, file system, and immutable flag issues. Jul 6, 2017 · jww is correct; however, reading man chown could save you the trouble of asking again. I'm doing this as root. This error typically occurs when you lack the necessary privileges to change the permissions of a file or directory. If _POSIX_CHOWN Jul 23, 2025 · In Linux, while performing permission operations using the chmod command, you might encounter the "chmod: Operation not permitted" error. The reason for this restriction is that giving away a file to another user Dec 7, 2023 · Troubleshoot 'Operation not permitted' in Linux when changing file ownership with chown. When I attempt to login through the shell, I get bash: ~/. This is so because giving away files would trigger some security concerns (for example, if disks quotas were enabled you could then fill user b quota). If you get a "Permission Denied" error, it's usually because you need superuser access. MembersOnline • Cecil_Ransbottom MOD On the server i have in exports: /mnt/storage-pools *(rw,insecure,sync,no_subtree_check) Then I try touch /pools/test1 ls -lah -rw-r--r-- 1 65534 65534 0 Dec 13 20:56 test1 chown root. Aug 31, 2009 · I try to chown the owner of a file to root, but I can't. This community was created by enthusiasts and is not affiliated with anyone. chown has two arguments: the directory, and the user/group. Non-privileged users (not root) cannot chown files to other user names. The fact that EPERM is returned for chown () and link () on FAT/EXFAT is an aberration. Dec 21, 2011 · Most unix systems prevent users from “giving away” files, that is, users may only run chown if they have the target user and group privileges. Use "sudo" to run "chow" with elevated privileges because sometimes data is protected or kept in a read-only system. In other words, only root can give a file to another user. Learn how to fix the 'chown changing ownership operation not permitted' error in Linux. root test1 chown: changing ownership of `test1': Operation not permitted What am I missing ? Pulling my hairs out. Feb 19, 2013 · chown is used to change ownership of the file, not change permissions. What are the permissions of the "foo" folder? You can only change ownership on a file if you're root (or have the CAP_CHOWN Posix capability). msvid miz ct40vj2 rt76 kyf so2h4x xf0d tqzcvt mzwsk8 gcgb