System Administration Guide, Volume 2

How to Change the Owner of a File

  1. Become superuser.

    By default, the owner cannot use the chown command to change the owner of a file or directory. However, you can enable the owner to use chown by adding the following line to the system's /etc/system file and rebooting the system.


    set rstchown = 0

    See chown(1) for more details. Also, be aware that there can be other restrictions on changing ownership on NFS-mounted file systems.

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


    # chown newowner  filename
    

    newowner

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

    filename

    Specifies the file or directory. 

  3. Verify the owner of the file is changed.


    # ls -l filename
    

Example--Changing the Owner of a File

The following example sets the ownership on myfile to the user rimmer.


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