I'm a relatively new Linux user and was transferring over to a new computer, so I decided to copy some files (some configs, downloads, and home files) over to a hard drive (from a previous laptop). Instead of using sudo nautilus I used sudo cp -r instead as I thought it would be faster. But when I transfer over these files to the new PC I can't do anything to them unless I use sudo (NOTE: the passwords of the two devices are different). Is there a way I can 'truly' copy these files ignoring these privileges. The command or technique can use sudo, as long as I don't need to use sudo ever again to access these files.

I have the old computer from which I got these files, but I don't currently have access to it, so I'm looking for methods that can be done on the new computer.

For example, I copied over some Projects that use make, and when I use make/make clean, It says that permission is denied, even though the folder is in my Home folder. So I need to pass in sudo for each of these commands in order for it to work.

Any sort of help will be appreciated, including guides of any sort. Thanks!


As you have used sudo cp -r the new files belong to the root user. If you want to copy files while maintaining the original permissions use sudo cp -p -r.

To "fix" your files now, try sudo chown -R yourusername filepath, where yourusername should be the proper owner of the files, instead of root, and filepath is the root folder where these files are.

Note that some filesystems (mostly legacy ones) may lack the support for such permissioning.

Try reading about file permissions and file ownership in linux. You will find out that you can do much more complex permissioning once you get to know how.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.