How do I copy files from a Unix server to a Windows client with SSH?

8,879

Solution 1

scp is the way that we do this. If you're using something like putty, it comes with pscp as part of it.

I prefer pscp over the standard scp since it allows you to specify a password on the command line, something useful for scripting.

An example invocation from one of my scripts (details changed to protect the innocent):

pscp -pw paxpwd src.tar.gz [email protected]:/usr/pax/tmp/src.tar.gz

This copies the src.tar.gz file from my local (Windows) directory to /usr/pax/tmp on my pax.com UNIX machine, using the pax/paxpwd user and password.

Your particular use case would be satisfied by:

pscp -pw biranchipwd [email protected]:abc/xyz.txt xyz.txt

Keep in mind that placing passwords into scripts is not generally a good idea since it means anyone that breaks into your local machine can easily break into the other machine as well.

Solution 2

you should check SFTP. Filezilla is able to handle SFTP session. also putty provide a pscp command.

Share:
8,879

Related videos on Youtube

nc4pk
Author by

nc4pk

I am a sophomore studying Computer Engineering at North Carolina State University in Raleigh, North Carolina.

Updated on September 17, 2022

Comments

  • nc4pk
    nc4pk over 1 year

    I have connected to a Unix server using SSH from my terminal from my Windows client.

    How do I copy files from the Unix server to the Windows client? Can I use the scp and rcp commands? Or are there other ways to do so?

    • Admin
      Admin over 14 years
      I think it belongs to superuser.com
    • Dan McGrath
      Dan McGrath over 14 years
      congrats on the baby windows client!
    • Admin
      Admin over 14 years
      @Dan: ?????? I didn't got it.
    • Admin
      Admin over 14 years
      "But i am having a windows client" as in "But i am having a baby". Crikey, humor shouldn't need to be explained :-)
    • Admin
      Admin over 14 years
      @pax & dan: sorry arf that's a good joke! but I am not native English speaker so kind of difficult to get that kind of joke!
    • Admin
      Admin over 14 years
      snif I didn't got any drop of reputation on that ^^ pax you rule them all...
    • RikuXan
      RikuXan over 14 years
      I've never seen a joke work on any stack* site, darn it. I've tried.
    • Almir Sarajčić
      Almir Sarajčić over 14 years
      But we can still keep trying, can't we?
    • quack quixote
      quack quixote over 14 years
      keep trying, @pavium... just use protection or you may end up with a windows client...
    • Shekhar
      Shekhar over 10 years
      possible duplicate of Copying files with SSH
  • K. King
    K. King over 14 years
    @techzen: did you read his question ? last time I checked there was no scp command on the windows distro ...
  • Kalyan02
    Kalyan02 over 14 years
    i accept your answer, can u please write the syntax for it. Say i have a file xyz.txt in my unix server under abc folder.I want to copy it to my windows desktop.
  • Kalyan02
    Kalyan02 over 14 years
    @biranchi: you do the reverse from your windows machice get/put whatever file. It won't be possible to copy from your unix box, since your windows box doesn't have a ssh server.
  • Kalyan02
    Kalyan02 over 14 years
    @Biranchi, see the update for a sample command on the Windows side. @RageZ, if you install Cygwin, there's an ssh deomon that you can run but I'd still suggest just using the client on Windows and server on UNIX.
  • Kalyan02
    Kalyan02 over 14 years
    @pax; you are right you can run sshd on windows but more easy to use the unix server since it's already there ^^
  • Kalyan02
    Kalyan02 over 14 years
    @RageZ: I am using putty to ssh to my unix server.
  • Joey
    Joey over 14 years
    Eek! And s?he's writing to the root of the C: drive. Where you shouldn't even have write permissions, usually. That'd be, like, telling UNIX users to download files somewhere to /