Changing Ownership Of A File Using Chown

Recently I encountered a problem when I ftped to my server, I was trying to upload a file that already existed under my username on the server, and I kept getting a 550 error. Which for you newbies out there is a file permission error, telling me that I do not have rights to write over or delete those files under my username.  That made me mad, I didn’t know what was going on I thought my FTP server was messed up.  Then we figured out that the problem could have been who owned the files.  Surely enough, the files were owned by root instead of a pinhead which was the username I was under.  If your files under your username are owned by root then that will allow your file permissions to be limited and you not to be in control of them.  So how do we fix all this?

Chown is the command that will change the user and/or group of each given file. If only a user name (or numeric user ID) is given, that user is made the owner of each given file, and the files’ group is not changed.  If the user name is followed by a colon and a group name (or numeric group ID), with no spaces between them, the group ownership of the files is changed as well.

Output chown [options] user:[group] file

In our case we are defining a different owner for the file, so the output should look like
this…

Output chown -R user:[group] file

To find out what files are owned by who in the directory you are in type
ls -al

I hope it has been a useful article.