Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to transfer a file from a UNIX server to a Windows 2003 Server, so I downloaded copssh onto the Windows server, and openssh is already installed on the UNIX server.

When I execute the following command (on the UNIX server):

scp -r /file_in_unix/ user@windows_hostname:\c:\\

The following output appears (on the UNIX server's sceren):

100% |***********************************************************| 562 00:00

However, When I go to see file in the C drive on the Windows server, I don't find anything. Why isn't the file showing up?

share|improve this question

migrated from stackoverflow.com Oct 4 '10 at 10:50

This question came from our site for professional and enthusiast programmers.

    
Have you used Windows' search functionality to locate the file you copied? Maybe it is there but not in the location where you look? –  Olfan Oct 6 '10 at 14:15

5 Answers 5

up vote 6 down vote accepted

The destination path looks wrong - to most unix shells the backslash is an escape character not a path marker, so I'm guessing the file has dropped into the SSH user's home directory with an odd filename.

IIRC copssh is based on cygwin, so what you probably needed to run is:

scp -r /file_in_unix/ user@windows_hostname:/cygdrive/c/

An alternatives to copying to a SSH service on the Windows machine is to use a GUI client like WinSCP on the Windows box to login to the Unix machine and pull the files over that way - though this is not suitable if you are trying to automate the process.

If you have privileged access on the unix machine (i.e. you are, or can become via sudo or similar, root) and have the relevant support installed you could just copy the files onto a Windows share. You don't say what Unix you are using. For Ubuntu and similar checking that support is present and installing it if not can be done with sudo aptitude install smbfs, you can them mount a Windwos share with something like sudo mount -tcifs //11.22.33.44//sharename /mnt/tmp -ousername=WindowsUserName (where 11.22.33.44 is the IP address of the windows machine, depending on your network setup you may be able to refer to the machine by name rather than address). Once you've done that you can just use the basic file management tools (cp, mv, ...) to interact with that Windows share and call umount /mnt/tmp when you are done. You might want to choose a more meaningful mount point name than /mnt/tmp. You can leave the share mounted, of course, if the transfer of the data is to be automated/scheduled. This method does assume that the Unix machine can see the Windows machine's fileshares through any firewall arrangements that may exist between them.

share|improve this answer
    
CopSSH which the question mentions is based on Cygwin's port of OpenSSH, so I expect it to behave almost identically. For other SSH/SFTP/SCP implementations you might need to use Windows style drive names and path separators, in which case the command in the question would probably need a little extra escaping to avoid these characters getting interpreted by the shell instead of passed to the other side. –  David Spillett Dec 12 at 9:46

You can also do it the other way round and pull files from the Windows side instead of pushing from the Unix side. Have a look into tools like WinSCP which is a graphical tool for SCP file transfers giving you a choice between the Windows Explorer or Norton Commander look and feel, both of which should be intuitive to you. Once logged in, you can navigate to the files of interest "the Windows way" and drag and drop them to wherever you want them.

share|improve this answer

I just did this, from a Linux server, to a Windows server, and verified it.

scp test.txt someguy@someserver:/tmp/

/tmp is on the C drive of a Windows Server. It didn't like anything to do with C, so I dropped it, and it worked.

share|improve this answer

Use WinSCP tool. Works like a charm.

share|improve this answer

Why not install Samba on the Unix box? Then you can map drives between the two systems. Alternatively, I would use psftp (from the putty suite) rather than the command-line scp, since you aren't familiar with it and apparently do not need to script it.

share|improve this answer
    
Samba is a big security risk. Lot of file pilfering occurs with Samba installed. –  sunk818 Dec 11 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.