System Administration Guide: Security Services

How to Change the Owner of a File

Use the following procedure to change the ownership of a file.

  1. Become superuser or assume an equivalent role.

  2. Change the owner of a file by using the chown command.

    # chown new-owner  filename


    Specifies the user name or UID of the new owner of the file or directory.  


    Specifies the file or directory. 

  3. Verify that the owner of the file has changed.

    # ls -l filename

Example—Changing the Owner of a File

In the following example, the ownership on myfile is changed to the user rimmer.

# chown rimmer myfile
# ls -l myfile
-rw-r--r--   1 rimmer   scifi   112640 May 24 10:49 myfile