Last Updated: February 25, 2016
·
882
· lamhoifai

Change Ownership

In Unix, if you want to change ownership for a particular file, you can type:

sudo chown -R {username}:{group} {target_file}

For example:

sudo chown -R alvin:alvin .git

2 Responses
Add your response

Your first example is not exactly right. The second {username} is not username but the group's name. Note that there are groups with every user's name but you change it to something like www if you'd like to allow your webserver to handle the files.

sudo chown -R {username}:{group} {target_file}

chown

over 1 year ago ·

@lazerviking Thanks your comment to let me know my mistake. Let me change it. : )

over 1 year ago ·