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

/home/mywebsite/public_html/filename.zip

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

chown lophost:lophost /home/mywebsite/public_html/filename.zip

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/filename.zip

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

Our Top Rated Host

Related Posts