How to change owner of a file on a Linux server

chown command is used to change owner of a file on a Linux server.

Syntax of chown command is:

chown user:group filename

Suppose you want to change owner of following file to a new user whose username is lophost


Login to your server as root via SSH, and execute following command:

chown lophost:lophost /home/mywebsite/public_html/

You can also use user ID of the user. Let’s say you want to change ownership of file to user ID 526. So, our SSH command will be:

chown 526:716 /home/mywebsite/public_html/

Where 526 is user ID of that user.
And 716 is usergroup of that user.

Our Recommended VPS Hosting

Leave us a Reply

Your email address will not be published. Required fields are marked *

* *