?
Solved

How to Download File to Desktop via SSH

Posted on 2013-06-07
13
Medium Priority
?
627 Views
Last Modified: 2013-06-08
Hello Experts,

I've just got finished researching this topic on the Internet and I am as confused as ever.  I am not a server person (I'm telling you this up front, so be gentle) so I really don't know what I am doing.

I am connecting to a remote server via SSH and Putty and I would like to download a file from that server to the Desktop of my Windows computer.  From everything I have been reading, it looks like I would use the SCP command, but what is the proper syntax?  Everything I've tried from the examples I've seen on other websites does not work.

Thanks!
0
Comment
Question by:OmniUnlimited
  • 5
  • 3
  • 3
  • +1
13 Comments
 
LVL 5

Expert Comment

by:DOSLover
ID: 39231005
If you do not need a 'secure' download, you can use plain/simple ftp. On windows, open a command window (start, run, cmd) and try the ftp command.
      ftp userid@yourserver (you will be prompted for password)
      get yourfilename

For a secure download, you can download free ftp GUI client like FileZilla (https://filezilla- project.org/download.php)  or WINSCP (http://winscp.net/eng/index.php). After installing any of these ftp client, you can connect to your server and then just drag and drop files needed from the server to your desktop.

Another option is to use command line secure ftp. Please see this link: http://java.sg/how-to-sftp-from-windows-command-prompt-using-psftp/
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39231025
Hi DOSLover, and thanks for the reply.

I probably should have made some points clear in my question:

1. I am not interested in alternatives to using SSH to download.  My question is very specific and requires only one answer.
2. I am not interested in having to read anything other than the answer that gets posted right here.  As I mentioned in my question, I just finished an exhaustive search of the Internet and I don't want to hear anything more from those old articles.

This is very simple.  I just need an expert to tell me which SSH command to use and its proper syntax in order to accomplish what I am trying to do.
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39231075
scp username@hostname:/path/to/file /path/to/desktop/

i never used putty's scp or can't remember but i assume the syntax is the same (usin pscp instead of scp)

if you need more help, please include the exact command you type and the output, i'll install putty on a test machine if required
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39231092
Thanks for the reply skullnobrains.  Your answer is similar to that which I read about.

Here is the problem I was having with that:

Having tried the command it seems that the first parameter (username@hostname:/path/to/file) should refer to the remote server, which makes no sense since I am already logged into username@hostname.  The second parameter with no identifying remote information (/path/to/desktop) seems to definitely refer to the remote server because executing the command scp username@localhost:testfile.txt / from one of the server subdirectories will deposit testfile.txt right in the root directory of the server.  I am thinking that I would need username@hostname to somehow identify my computer, and its syntax to be more like scp /path/to/file username@hostname:/path/to/desktop but I have no idea what "username" and "hostname" would be if that were the case.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39231107
Since you have Putty, you also downloaded the manual.  In case you didn't, here is the doc page with links to all the different versions of the manual.
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39231108
it does make sense. you are not supposed to type this command after you logged to the remote system. running scp on the server will let you download files to/from the server regardless where you are logged on from. the windows does not feature a ssh server so there is no way this would work.

you are supposed to use this from the windows shell and you do not need to login to the server with putty beforehad.

you need to download pscp.exe if you have not done so yet and stick it in the window's path if you want to be able to scp manually from any location without hassle. then type the provided command in the windows shell.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39231109
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39231112
Great, the server just went down.  I'll have to get back to you on this...
0
 
LVL 5

Expert Comment

by:DOSLover
ID: 39232052
Hi OmniUnlimited,
It will not work the way you are trying to do. You are logged on to the Server and trying to send file(s) to the desktop. The server doesn't 'know' or cannot reach the desktop - and even if does, it won't be able to 'push' the file to the desktop because for this to happen a ftp service should be running on the desktop - I doubt that based on you explanation.

What you need is a command(s) that can be used to connect to the server from the desktop and 'pull' the files from the server to the desktop. It can be plain ftp or secure ftp. There are specific commands, if you need help on that.
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39232359
Awesome, server is back up, I just tried running pscp using the instructions found at http://www.nber.org/pscp.html and the following syntax from the Windows Command Prompt:

pscp user@host:testfile.txt c:\Documents and Settings\User\Desktop

and I get a "More than one remote source not supported" error.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39232388
You probably still have Putty open.  Close it then run pscp.
0
 
LVL 27

Accepted Solution

by:
skullnobrains earned 2000 total points
ID: 39232391
no, you forgot to add quotes around the destination and since there are spaces in the path...

pscp user@host:testfile.txt "c:\Documents and Settings\User\Desktop"
0
 
LVL 17

Author Closing Comment

by:OmniUnlimited
ID: 39232402
Nice, clean, elegant, and exactly to my specifications without sending me to read a bunch of web pages.  Thanks skullnobrains,  I really appreciate this great solution, but I really think your moniker is a bit misleading.  I think you are really big in the brains department.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question