How do I copy files to read only directory

I want to copy some files to a directory but it says permission denied. I already ran sudo chmod -R a+rwx /path/to/folder the last time which left my system in lots of problems that I had to re-install Ubuntu. How do I go about this please as I am quite new to using ubuntu.

4

3 Answers

Have you tried to the files with 'sudo cp files directory' rather than to try to change the directory's permissions? Or, if you're going to be copying multiple files one at a time, you can use 'sudo su' login as root, then you don't have to type the sudo each time.

1

you can copy a directory located e.g. in your Home Directory to /opt/lampp/htdocs this way. Let the folder be test.

sudo cp ~/test /opt/lampp/htdocs

You can remove it by

sudo rm -r /opt/lampp/htdocs/test

Rather than copying the files with the cp command, i just granted permissions in the directory using sudo chmod -R 777 htdocs. Thanks all for the suggestions and help.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like