brock

Change Ownership of All Files and Folders in a Directory

13 Nov 2008

I use dynamic DNS for all of my domain names. This means that from time to time, I'll move a website from one server to another for testing. In these cases, it is helpful to be able to log in as the administrator on the parent account and ftp files through the parent account. It's confusing, I know.

But if you need to log in to FTP as an admin or some other user than the typical owner, you'll find that you can't FTP anything in since the directory is owned by that website. So I go in and quickly change the ownership of all files and folders to the admin user so that I can upload files again. Here's how you do it:

sudo chown -R adminUserName folderToChown