3

I have a file called fileArc.c and I was given instructions for an assignment that if I do the command

cp fileArc.c /pc

that this file would then be accessible in a created folder on my desktop. However when I try using the command I get

cp: cannot stat '/pc/fileArc.c': Permission denied

I am not sure what to do to fix this.

1
  • Are you sure the command was exactly cp fileArc.c /pc? Maybe there was ~ or . in front of the slash / character. Please recheck as this would be important Commented Oct 9, 2021 at 21:35

2 Answers 2

2

/pc is not a casual directory on Unix system. Users directories are generally in home user directories (/home/…/), you can also write on /tmp and some others destinations (mounted drives in media…)

Then the first copy should fail if the /pc directory doesn’t exist and you have no right on /. If you are root, the copy will succeed, but if there is no /pc directory, the copy will copy your file renamed /pc : not what you have intended to do.

You can have an idea of the permission of /pc and its content with the command ls -la /pc

0

like said above this is probably permissions of your folder /pc . if it is not created yet, this is about your user permissions, if it is created already, probably the best is to change the folder permissions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .