System Administration Guide

How to Change File Ownership


Note -

You must own a file or directory (or have root permission) to be able to change its owner.


  1. Become superuser.

  2. List the file permissions.


    # ls -l filename
    

    -l

    Displays the long listing, which includes the owner of the file, displayed in the third column. 

    filename

    Is the specified file or directory. 

  3. Change the file owner.


    # chown new-owner filename
    

    Ownership is assigned to the new owner you specify.

  4. Verify the file ownership change.


    # ls -l filename
    

Example--Changing File Ownership


# ls -l quest
-rw-r--r--  1 fred   staff    6023 Aug  5 12:06 quest
# chown ignatz quest
# ls -l quest
-rw-r--r--  1 ignatz   staff    6023 Aug  5 12:06 quest