3

How can I change a owner of a file in AIX? I created a file using my personal account and then I tried to change user for this file:

chown rootuser myfile.csv
chown: myfile.csv: Operation not permitted.

Then I changed to root user

sudo /usr/bin/su - rootuser

and tried to change the owner of this file

chown rootuser myfile.csv
chown: myfile.csv: Not owner

How can I change the owner of this file?

4
  • 2
    You are not allowed to change the ownership of any file you own to another user: this opens up a can of worms in terms of security. As for root not being able to do that, this is really strange. By any chance, are you in a corporate environment where you authenticate with something like NIS/LDAP? Is this file local to your box or is it from a network-shared partition? What is the file Bill_Item_Tag_data.csv? Is myfile.csv a symbolic link? – Joseph R. Sep 23 '13 at 18:48
  • Could you add some outputs to your question? <pre>id rootuser</pre> and <pre>lsuser rootuser</pre>. – dchirikov Sep 23 '13 at 18:56
  • @JosephR I edited my question. – jrara Sep 24 '13 at 3:46
  • try sudo chown rootuser myfile.csv – Erik Aronesty Jun 18 '15 at 20:35
2

You need to run chown as root.

Root means root: the user with user ID 0. If this rootuser is a user who has the permission to run commands as root by using sudo, that's not good enough. What rootuser can do is to run sudo chown … — the chown command must be run by root, the rootuser itself has no particular privileges.

1
  • Ok, I guess my rootuser is not really a root. Thanks a lot. – jrara Sep 24 '13 at 3:44
0

There are 2 scenarios for this question. A file which is owned by you and you want others to access then you go on with chmod command granting permission for the file while you still hold the Owner access. which means other users can view the file contents, edit the file contents, but not delete the file.

Suppose if you are leaving office and you want to give Ownership rights to one of your colleague during your absence then you go for chown command.

chown username filename- will make the changes to user
chown username:groupname - will make changes to user as well as group.

username above refers to the username for which you want to change ownership details.

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.