0% found this document useful (0 votes)
53 views

Chown Command

The chown command allows you to change the owner and group owner of a file. You specify the new owner and group owner separated by a colon, and must use sudo. For example, to change the group owner to mary while keeping dave as the owner, use "sudo chown dave:mary example.txt". You can also change both the owner and group owner at the same time such as "sudo chown mary:mary example.txt".

Uploaded by

Anudeep Putchala
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Chown Command

The chown command allows you to change the owner and group owner of a file. You specify the new owner and group owner separated by a colon, and must use sudo. For example, to change the group owner to mary while keeping dave as the owner, use "sudo chown dave:mary example.txt". You can also change both the owner and group owner at the same time such as "sudo chown mary:mary example.txt".

Uploaded by

Anudeep Putchala
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

chown

The chown command allows you to change the owner and group owner of a file. Listing
our example.txt file with ls -l we can see dave dave in the file description. The
first of these indicates the name of the file owner, which in this case is the user
dave. The second entry shows that the name of the group owner is also dave. Each
user has a default group created when the user is created. That user is the only
member of that group. This shows that the file is not shared with any other groups
of users.

You can use chown to change the owner or group, or both of a file. You must provide
the name of the owner and the group, separated by a : character. You will need to
use sudo. To retain dave as the owner of the file but to set mary as the group
owner, use this command:

sudo chown dave:mary example.txt

To change both the owner and the group owner to mary, you would use the following
command;

sudo chown mary:mary example.txt

To change the file so that dave is once more the file owner and the group owner,
use this command:

sudo chown dave:dave example.txt

You might also like