Linux : Change file/folder owner

On a Unix based system, all files and folders belong to a group and a owner. Or rather, an owner and a group has specific permissions to read, write and execute files. So you might need to change the owner of certain files and folders so that you’ll be able to open them, edit them and write to them again.

I’ll show you how to do this via SSH. You’ll need a login and password in order to access the shell.

ssh -lroot domain.com

Once logged in, change the directory to the one where the files/folders are located.

cd /var/www/vhosts/domain.com/httpdocs/myfolder/

Then you might want to recursively change the owner for all files and folders inside that directory to another user. Lets set the owner of the files and folders to “peter”

chown -R peter *

That is all there is to it. You have just changed the owner of all files and folders recursively inside the specified directory to “peter”. You can now open the files (for example via FTP), edit them and write back to them again. Good luck!

Comments

  1. By avatar

  2. By Ivan

  3. By Les

  4. By Eduardo

  5. By Pawan

  6. By quimkaos

  7. By ligrex

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>