Difference between revisions of "Change ownership of linux files"

From Ucsbgalaxy
Jump to: navigation, search
(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…")
 
 
Line 1: Line 1:
 
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 superuser privileges, see Todd.  
 
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 superuser privileges, see Todd.  
 +
 +
 
Unprivileged (regular) users who wish to change the group of a file that they own may use '''chgrp'''.
 
Unprivileged (regular) users who wish to change the group of a file that they own may use '''chgrp'''.
  

Latest revision as of 13:53, 15 November 2011

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