Saturday, 20 August 2011

Changing Owners and Groups

While creating an account on Unix, it assigns a owner ID and a group ID to each user. All the permissions mentioned above are also assigned based on Owner and Groups.
Two commands are available to change the owner and the group of files:
  1. chown: The chown command stands for "change owner" and is used to change the owner of a file.

    Syntax

    chown [-R] newowner filenames
     
    -RChange the permission on files that are in the subdirectories of the directory that you are currently in.
    newownerThe alias/username of the new owner of the file.
    filenamesThe file that you are changing the rights to.

  2. chgrp: The chgrp command stands for "change group" and is used to change the group of a file.


    The chrgp command changes the group ownership of a file. The basic syntax is as follows:
    [amrood]$ chgrp group filelist


    The value of group can be the name of a group on the system or the group ID (GID) of a group on the system.
    Following example:
    [amrood]$ chgrp special testfile

No comments:

Post a Comment