System Administration Guide

Changing File and Group Ownerships

Frequently, file and directory ownerships change because someone edited the files as superuser. When you create home directories for new users, be sure to make the user the owner of the dot (.) file in the home directory. When users do not own "." they cannot create files in their own home directory.

Access problems can also arise when the group ownership changes or when a group of which a user is a member is deleted from the /etc/group database.

Use the chown command to change file ownership.


# chown new-owner filename

new-owner

Is the specified user-name or UID of the new file owner. There must be an entry for the specified user-name in the passwd file.

filename

Is the specified file or directory. 

Use the chgrp command to change group ownership.


# chgrp new-owner filename

new-owner

Is the specified group ID or GID of the new group owner. There must be an entry for the specified group-name in the group file.

filename

Is the specified file or directory.