[SOLVED] chown: changing ownership of `<file>': Operation not permitted
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
chown: changing ownership of `<file>': Operation not permitted
Hello,
I am trying to change the ownership of a file but I get the next message:
chown: changing ownership of `<file>': Operation not permitted
The situation is as follows.
My username: schuurs
My primary group: meten
My secundary group: agi
My home directory is located on server "srmc"
cp <file> /home/agi/library/import/.
ls -l /home/agi/library/import/<file>
-rw-r--r-- 1 schuurs meten ...... <file>
User rights import directory drwxrwxrwx
Owner import directory: agi
Group import directory: agi
Primary group of user agi: meten
Secundary group of user agi: agi
Agi's home directory is located in server "dt"
If I am trying to change the ownership (chown) of the previously copied file to 'agi', I will receive the message that the operation is not permitted.
Next to that, it is possible to change the group (chgrp)of the file to 'agi'.
If I copy the same file to a different user, it is possible to change the ownership.
Does someone has a clue if I am forgetting something?
That is normal when there are no FACLs. In a recent posting someone mentioned the ls command's -Z option to show any SElinux access restrictions. Can you try that and post back?
Another possibility is that the file is on a read-only file system. Are you able to create or modify files in the same directory as the problem file?
Only root can change file ownerships. If you copy a file, you are creating a new one. Some *nixes support suid directories where the ownership is changed to that of the directory owner. You can use chgrp if you are member of that group.
You can use setfacl to give permissions to another user. ( The "acl" mount option needs to be used and the filesystem must allow it )
You said that your home directory is on another server, and the prompt seems to indicate you are logged in with ssh or rsh to that system. Is that server Linux?
The workstation is using RHEL3.7, SElinux is not existing in this OS.
However, the server on which "agi" is located is using RHEL5. I have to ask the system manager of this server.
I do not know which OS is used by the server where my home disk is located on.
Next to that, I can create and modify files. This means that it is not a read-only file system.
Dear jschiwal,
If only root can change the ownership, why can I change the ownership of a file if I copied it to the location of a different user?
Maybe, this is true on the RHEL5 server and not on servers with an older OS.
My prompt is how I created it, I am not using ssh.
I can use "cd" to walk to the location I need on the "agi" disk.
Because copying creates a new file and the new file is created with your default owner, group and permissions.
The file on which I am trying to change the ownership is also having my default owner and group permissions.
I checked with the system administrator if SElinux is bugging me. We tried by disabling it for a short moment, but without succes. SElinux is not bugging me.
Do you know if it is possible to disable the behavior of only let root change the ownership of a file?
The reason is as follows:
A test engineer copies a testprogram to the import directory.
One of the library managers copies the testprogram to one of the testprogram libraries without using logging in as "agi"
this is blocked so that only the persons who are part of the group "agi" can copy a testprogram to one of the libraries.
The end owner of the testprogram should be "agi", not the library manager who copied the testprogram.
This worked when the account of "agi" was still located on an HP-UX system. Now that it is located on a RHEL5 system, it does not work anymore.
You could use groups, guid and umask or you could use sudo to allow the changing of file permissions. The first is by far the preferred method though - you can do a lot of damage if you change the permissions of a file incorrectly!!
I agree with you.
It this moment the library permissions are arranged with groups and I think I have to accept the fact that there are differences between the old HP-UX and Linux.
Our storage server is a ZFS box, and it cares about which host a root request (e.g., chown) is coming from. If the storage server knows about the host and the host user is logged on as root, the request will execute as expected. If the storage server doesn't know about the host, the host user's root credentials are mapped to anonymous, which causes the "Operation not permitted" message, too.
Solution: get the storage system administrators to add your host as a recognized root user.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.