Cp: Cannot Create Regular File '/Home/Documents': Permission Denied

I am learning linux CLI, I created a file app.txt in home directory. Now I am copying it through CLI to Documents and it is showing me an error:

cp: cannot create regular file '/home/Documents': Permission denied

P.S (I have checked whoami and it is showing zain which is my root)

Can anyone confirm what is wrong with it ?

2

2 Answers

I will assume you attempted to copy app.txt while in your home directory.

Since your root directory is zain, specifying /home/Documents as the destination path will result in an error as the CLI will go back to zain directory (due to /) and then look for the home directory, which is absent under it.

Instead, you just need to specify Documents as the destination path as follows. Again, I am assuming you are still in your home directory.

cp app.txt Documents

give 777 (readable, writable and executable) permissions to file or directory

sudo chmod -R 777 /folder-location

Your Answer

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

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest