SCP from Linux to Windows freeSSHD

I have installed freeSSHD on Windows Server 2008, I would like to simply scp files to the server...
I have configured passwords, and ssh-keys.

i can
ssh -P 9000 root@WinServ (works perfectly WinServ replaced with IP address)

I have two issues when scp-ing files

One the files never get to the windows server

scp -v -P 9000 'root@WINSERV:' /tmp/test

Two Not 100% sure of the syntax for the Windows file server part of the command.

Looks like it should work?
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to [] port 9000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type 2
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version WeOnlyDo 2.1.3
debug1: no match: WeOnlyDo 2.1.3
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:16
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Offering public key: /root/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 433
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -f .
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status -1
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I've never used the windows server, but the syntax looks wrong in general
scp   somefiletocopy.txt   somename@someserver:/tmp/filedir/
The problem is that you are not specifying what do you want to copy from Winserv.
Put a wildcard (like below) or a filename, and it will be copied to /tmp/test
scp -v -P 9000 'root@WINSERV:*' /tmp/test
If you want to copy some folder recursively, use "-r".

For the windows side, you can use programs like WinSCP to have an interactive session from where you can connect and copy files with simple drag & drop.

If you have any further questions, let us know. G' luck!
Alberto CortesCommented:
Your syntax should be:

scp -v -P 9000 <file_to_copy> root@WINSERV:/tmp/test

<file_to_copy> should include the complete path and file name.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

hdazAuthor Commented:
Thanks for the suggestions, I know the syntax is not the same as I would do for a linux machine but thats the only example I could find online...

scp -v -P 9090 /home/sbsbody/matrix_11153 'root@*'

does the same for me

The /tmp/test is the file I am sending not the location on the windows server I am sending too I have tried d:\ as well as just a folder name, idealy I would like it to be D:\Backups

debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0

nothing is ever sent, but no error is returned
The syntax is:

So in your case, the last asterisk is wrong. Try without it:
scp -v -P 9090 /home/sbsbody/matrix_11153 root@
This should copy /home/sbsbody/matrix_11153 into the home directory defined for root in

Remember to check WinSCP, as I'm sure it will cover most of your needs on the Windows' side.
Let us know how goes. Regards!
hdazAuthor Commented:
t-max- thanks for the reply..

  scp -v -P 9090 /home/sbsbody/matrix_11153 root@

debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0

i.e. nothing sent... either there is a problem with scp and the keys even thought they say accepted or the syntax of the command or something wrong in freeSSHD setup.

WINSCP, i can certainly set up WINSCP to grab a file or folder not a problem at all, but I dont want the Windows box to have access to the Linux server, I want the Linux server to have access to the Windows Server. Hence the logic in trying to find this solution.

eventually it will all be done via crontab....
Read this
Perhaps the info there will help you solve it.
hdazAuthor Commented:
Not 100% on which problem I am hitting... but it does look similar.

find the probem!

Change the SFTP server settings under the FreeSSHd GUI. Put away the $HOME in the 'Home Path'. A 'password stored as SHA1 hash' user do not have a $HOME.
Maybe someone of freeSSHd can fix this, because it takes you a long time, because the logging do not give a lot information.
I tried putting in C:\Users\<USERNAME>\ not sure what is meant by the above...

still gives me the same results.. I am going to try this on a fresh-ish VM and see if I can get it to work.... I am sure I had it working at home but can not remember if it was scp or just ssh...

Thanks for your help...
First, can you actually ssh into the server?  If you can't ssh, you won't be able to scp.
hdazAuthor Commented:
        yes 100% I can ssh into the server
   ssh -P 9000 root@WinServ (works perfectly WinServ replaced with IP address)

  I did see that guide while looking for solutions pretty much identical from the install and configure side, apart from trying different options along the way..  The only other part might be win2008 and or permissions within windows.

The install looks like it was done on XP because of the word document.
When you ssh into Winserv, in which directory are you placed?
Do you have write permissions on that directory?
If you can ssh in with the keys, then scp is no different and the problem shouldn't be the keys.  

To try to troubleshoot, you might try using filezilla from the linux side as it can use ssh for the transfer (similar to winscp from windows).
hdazAuthor Commented:

always taken me to

ssh -p 9090 root@
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.


Iv not ssh-ed in for a while, this time it seems locked solid, the last time i did a dir, but due to the console being very hard to read, i.e. it was over the top of previous Linux commands did not try much else...

just tried twice and both times locked solid at C:\Windows\system32>
Well, that might be the problem.

\Windows\system32 is a special folder, and not everyone has rights to write inside it.
Can you change the home directory for the root user in the freesshd?
I would try creating a folder c:\root, with full permissions to everyone.
If that works, permissions and default home directory was your problem.
hdazAuthor Commented:
After playing with freeSSHD settings I can log in and create a file

echo test123 > test.txt

C:\Windows\system32>dir test.txt
 Volume in drive C is System
 Volume Serial Number is 42CC-DBA7
                                                                               st 643860771
 Directory of C:\Windows\system32

01/03/2011  18:35                10 test.txt
               1 File(s)             10 bytes
               0 Dir(s)  50,719,567,872 bytes free

The above was via Password stored as SHA1 --- and manually entering the password.

doing anything via

scp with the same settings as ssh(es) above shows

debug1: Sending command: scp -v -t /
debug2: channel 0: request exec confirm 0
debug2: callback done
debug2: channel 0: open confirm rwindow 131072 rmax 98304
debug2: channel 0: rcvd close
debug2: channel 0: output open -> drain
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.0 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status -1
lost connection

as if no shell is being established correctly....

going back to the end of the string ".210:/Desktop/" might be the reason / logic?
hdazAuthor Commented:
Looking at the logging from freeSSHD

03-01-2011 18:55:05 IP SSH root successfully logged on using password.
03-01-2011 18:55:10 IP SSH root disconnected.

Can you connect and do it with filezilla?  With password?  With keys? It might help with the troubleshooting.
hdazAuthor Commented:
Just tested from home as I set it up on one of my machines over a year ago....

the answer is to forget about scp and use sftp... doing this on XP works well...

I'll update this tomorrow if I am right and there are no other complications...

hdazAuthor Commented:
OK this looks perfect... using sftp I worked out what the file path should be..
lpwd and pwd

scp -P 9090 file2send user@WinServ:/home/user/

so in my case the scp will be
scp -P 9090 root@WinServ:/home/root/


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
That's great news!
Indeed it was problematic to use "root@winserv:" because you don't specify any path. In a linux box that's translated to the user's home directory, but it seems freesshd has some problems without it. Cheerz!
Good news that sftp helped work things out.
Since it looks like comment 35011168 suggesting filezilla (sftp) helped solve the problem, it should probably be given a share.
hdazAuthor Commented:
Just out of interest I did not use filezilla i just used SFTP command line which syntax is different than scp's.

I still prefer to use scp and I wanted to modify Windows in order to achieve my goal. so far that's not been 100% possible.

my alternative is to use CYGWIN instead of FREESSHD if all efforts fail with FREESSHD.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.