5

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 screen):

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?

1
  • 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, 2010 at 14:15

5 Answers 5

10

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.

1
  • 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. Dec 12, 2014 at 9:46
2

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.

2

Use WinSCP tool. Works like a charm.

1

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.

-1

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.

4
  • Samba is a big security risk. Lot of file pilfering occurs with Samba installed.
    – Sun
    Dec 11, 2014 at 20:11
  • What do you mean by "pilfering"?
    – CarlF
    Jan 12, 2015 at 14:49
  • cvedetails.com/vendor/102/Samba.html
    – Sun
    Jan 12, 2015 at 18:04
  • @Sun Windows has even more vulnerabilities, so many in fact Microsoft has to issue monthly updates. Sometimes more than 12 a month. Samba is not inherently more vulnerable as they are speaking the Microsoft based protocol. As long as you secure it properly samba shouldn't be a problem. You can always cut and paste the file from windows to another volume it, then the share will be empty.
    – cybernard
    Apr 7, 2017 at 13:13

You must log in to answer this question.

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