Changing File Permissions in Ubuntu

Ok, so I have all my files on a back up external hard drive. I got a new hard drive for my computer and I want to transfer all my files to my new system. But after transferring them it tells me I don’t have permission to access them. What do you do?

Unfortunately the only way to change file permissions in mass is through the terminal.There is no GUI (Graphical User Interface) that will work.

To change group ownership for all files in a directory type the following in the terminal, replacing “jay” with your user ID. It is case-sensitive. Please be careful, you are using sudo which is powerful. This is valid as of February 2011.

sudo chown :jay -R /home/jay/Documents/
sudo chown :jay -R /home/jay/Music/
sudo chown :jay -R /home/jay/Pictures/
sudo chown :jay -R /home/jay/Videos/
sudo chown :jay -R /home/jay/Downloads/

To change group ownership for all files in an external USB device.

sudo chown :jay -R /media/USBdrive/

To change file ownership for all files in a directory type the following in the terminal, replacing “jay” with your user ID. Notice the only difference is the absence of “:”

sudo chown jay -R /home/jay/Documents/
sudo chown jay -R /home/jay/Music/
sudo chown jay -R /home/jay/Pictures/
sudo chown jay -R /home/jay/Videos/
sudo chown jay -R /home/jay/Downloads/

To change file ownership for all files in an external USB device.

sudo chown jay -R /media/USBdrive/

The “sudo” gives you root access, the “chown” changes ownership. The “-R” means to apply to all files in the directory, and the rest is the location of the directory to be modified. You can’t apply it to “/home/jay/” because there are some files that need to be protected.

Spread the love

Published by

Jay Forrest

Jay Forrest is a long‑time Linux enthusiast who switched to Ubuntu in 2008 after a Windows XP virus convinced him to embrace open‑source software. A former host of the Linux User Podcast, Jay has worked in technical support for AOL, EarthLink, and Route 66 Casino, built his first 486 in the 90s, and has provided web design for businesses and nonprofits. He works with HTML, JavaScript, CSS, and basic PHP, and enjoys exploring open‑source software. As a former Fedora Ambassador, Jay is dedicated to sharing why Linux—secure, stable, and open—remains his platform of choice.