0

First, I want to say I am sorry if this is posted in the wrong section. this is my first post here, and this is the first time I'm making an account.

What I am trying to do is copy a file from a remote server to my local machine. So I found out through google you do it with scp.

I'm ssh-ing into the server, and do:

scp -P 8888 username@websitename:public_html/index.html/Documents/newfolder

but I get this error:

scp: /public_html/index.html: No such file or directory

But, on the remote server, if I do cd public_html and then ls, i can see the file there. The same thing happens if I log out of ssh and do it from a normal terminal.

What am I doing wrong?

2
  • What is username's home on the remote machine, does /etc/passwd think it's the same as what you think it is? Note how your scp invocation uses websitename:public_html/index.html (which implies ~ as the starting point), but the error says /public_html/index.html (which suggests that public_html lies in the root directory...
    – tink
    Aug 19, 2022 at 0:45
  • indeed, the full path to the file is /home2/username/public_html/index.html. i changed that, so now we have: scp -P 8888 username@websitename:/home2/username/public_html/index.html/ /home/localname/Documents/newfolder but now it says: /home/localname/Documents/newfolder: No such file or directory what's the reason? the folder is there on the local machine Aug 19, 2022 at 0:49

1 Answer 1

0

I think that the path you want is without the index.html. Because that is just a file, its not a folder. And you are not browsing with a browser.

scp -P 8888 username@websitename:public_html/Documents/newfolder

2
  • you were kinda right. not the full explanation, but sent me into the right direction. for whatever reason using -r will make it work, even if i copy the whole folder, even if i copy only the index.html file. i have no idea why adding -r option worked, because its definition is "copies the entire directory recursively", even though it works just fine if i copy just the index.html file. tldr: -r made it work, i do not understand why at all. Aug 19, 2022 at 1:00
  • -r makes no difference for me.
    – John Smith
    Nov 21, 2023 at 8:14

You must log in to answer this question.

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