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?

jrara
  • 2,089
  • 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?
    id rootuser
    and
    lsuser rootuser
    .
    – dchirikov Sep 23 '13 at 18:56
  • @JosephR I edited my question. – jrara Sep 24 '13 at 03:46
  • try sudo chown rootuser myfile.csv – Erik Aronesty Jun 18 '15 at 20:35

2 Answers2

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.

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.

terdon
  • 242,166
Siva
  • 9