Change ownership of linux files

From Ucsbgalaxy
Revision as of 13:52, 15 November 2011 by Pankey (talk | contribs) (Created page with "The '''chown''' command (abbreviation for '''ch'''ange '''own'''er) is used in Unix to change the owner of a file. Usually, it can only be executed by the superuser. To get sup…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The chown command (abbreviation for change owner) is used in Unix to change the owner of a file. Usually, it can only be executed by the superuser. To get superuser privileges, see Todd. Unprivileged (regular) users who wish to change the group of a file that they own may use chgrp.

To change the ownership permissions, first look at the current permissions with ls -l:

    -bash-3.2$ ls -l
    -rw-r----- 1 lab lab 324742643 Oct 10 17:28 file.txt

The output indicates that 'lab' is both the owing user and the owning group.

To change the owing group to 'illumina' (as required for uploading data to knot), use chgrp

    -bash-3.2$ chgrp illumina file.txt

Confirm the group ownership has changed with ls -l:

    -bash-3.2$ ls -l
    -rw-r----- 1 lab illumina 324742643 Oct 10 17:28 file.txt