SCP says file has downloaded, but the file does not appear

 ̄綄美尐妖づ 提交于 2021-02-04 19:41:45

问题


I am using ssh to work on a remote server, however when I try to download a file using scp in this format:

scp name@website.com:somefile.zip ~/Desktop

It asks me for my password, and shows this:

somefile.zip                                      100% 6491     6.3KB/s   00:00   

however, this file never appears on my desktop. Any help


回答1:


I think that you are logging into the remote machine using ssh and then running the command on the remote machine. You should actually be running the command without logging into your remote server first.




回答2:


You need to specify the file path

scp name@website.com:/path/to/somefile.zip ~/Desktop   



回答3:


~/Desktop should actually be a directory, not a file. I suggest that you do the following:

  1. Remove the ~/Desktop file with rm ~/Desktop (or move it with mv if you want to keep its contents).
  2. Create the directory with mkdir ~/Desktop.
  3. Try again to scp the zip file.

BTW, when I need to copy files into directories, I usually put a slash after the directory to avoid such problems (in case I make a mistake), e.g. scp server:file ~/Desktop/; if the directory doesn't exist, I get an error instead of unwanted file creation.




回答4:


You are doing this from a command line, and you have a working directory for that command line (on your local machine), this is the directory that your file will be downloaded to. The final argument in your command is only what you want the name of the file to be. So, first, change directory to where you want the file to land. I'm doing this from git bash on a Windows machine, so it looks like this:

cd C:\Users\myUserName\Downloads

Now that I have my working directory where I want the file to go:

scp -i 'c:\Users\myUserName\.ssh\AWSkeyfile.pem' ec2-user@xx.xxx.xxx.xxx:/home/ec2-user/IwantThisFile.tar IgotThisFile.tar

Or, in your case, (that is with the VERY strong password you must be using):

cd ~/Desktop
scp name@website.com:/path/to/somefile.zip somefile.zip


来源:https://stackoverflow.com/questions/24599754/scp-says-file-has-downloaded-but-the-file-does-not-appear

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!