0

I used the following command:

scp -r root@IP:/home/user/remotefolder /localfolder

After entering my passphrase (I'm using SSH key), I get the following error:

/remotefolder: Read-only file system

Not sure why I get this error. When I log in as root, I can copy this folder to another location within the server, but the command above doesn't work. Since I'm copying from remote to local, why would a read-only folder/file affect a copy?

5
  • 1
    Have you double-checked that /localfolder is not on a read-only mount? I think the error message is supposed to be understood as "while copying /remotefolder, the following error occurred: …" Commented Sep 2, 2023 at 17:33
  • /localfolder is my mac machine. I previously had an error where i used /Download and it stated that it was read-only. Changing localfolder to / fixed it (I assume) and the error was subsequently /remotefolder. Commented Sep 2, 2023 at 18:41
  • @SottoVoce it worked, thank you so much! Commented Sep 2, 2023 at 20:01
  • what is trhe root filesystem on you mac? Commented Sep 2, 2023 at 23:57
  • Please update your question with the exact (unmodified) command and error message. Commented Sep 3, 2023 at 8:03

2 Answers 2

2

In your last argument to the scp command, try ~/localfolder instead of /localfolder. You don't have permission to create a folder under your Mac's root folder (/), but you do have permission to create it under your home folder (~/).

5
  • Note that the error mentions /remotefolder, not /localfolder. I'm hoping that's a typo, but that's what the question currently says. Commented Sep 3, 2023 at 8:01
  • @Kusalananda the comments on the question, which added useful information, used /localfolder as the local folder name. I'm sure the actual command spacified the same folder name for both remote and local, and the OP assumed the error was about the remote computer permissions instead of local computer permissions. My answer was originally a comment and the OP commented that my advice worked. Commented Sep 3, 2023 at 19:04
  • Yes it was the remotefolder. Initially when I used /User/localfolder, it stated that read only error was at the local folder. When I changed it, the error was on the remote folder. “~” fixed it Commented Sep 4, 2023 at 8:12
  • @Limerick This makes no sense. Commented Sep 13, 2023 at 18:44
  • @Kusalananda I believe Limerick's comment is saying the same thing as my comment. Commented Sep 14, 2023 at 3:48
0

This is what you want: scp -r root@IP:/home/user/remotefolder ./localfolder

Note: note ./ vs /.
/ this is system root folder that you should not use

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.