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 need to send files to a server using ssh. I have never used ssh so this is being really frustrating to me. Mention the client (me) is using windows and the server is using Ubuntu.

I connected to the server using ssh2 ip, and then loging with an account I have. Now, I would like to send my files to a folder in the server, so, I moved to the folder and I used this command:

scp test.txt user_name@host_direction server_folder_destination

And it always return that it can't do 'stat' over test.txt, the file doesn't exist, and so.

I'm assuming ssh2 can't see the file in my computer root (C:), so I tried to specifie more and added: C:\test.txt, but apear the same error. I don't know what is happening.

Any hints please? Thanks

share|improve this question

migrated from stackoverflow.com Jul 2 '12 at 6:32

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

1  
"It always returns some kind of error, and so." Be specific - can you, possibly, copy and paste both the invocation, and the error. (If you're on Windows, perhaps try the WinSCP client? It's free and it has a quite useful GUI; I found it much easier to use than the command-line tools available for Windows) –  Piskvor Jul 1 '12 at 12:08

2 Answers 2

scp test.txt user_name@host_direction server_folder_destination

That isn't the right syntax. You need to do something like this:

scp test.txt user_name@host_direction:server_folder_destination

Note the : -- that tells scp you want to copy the local file 'test.txt' to host host_direction, connecting with user user_name, and store it in server_folder_destination (which will default to being relative to the remote user's home dir). See the scp(1) man page for more details.

share|improve this answer

ssh is for running commands remotely. Use scp (or sftp) to transfer files to or from a remote host.

# send text.txt from this machine to /destination/path on remotehost
scp test.txt user@remotehost:/destination/path

# get test.txt from /foo/bar on remote host and store it here as foo.txt
scp user@remotehost:/foo/bar/test.txt foo.txt
share|improve this answer
    
That is what I did. Did you read the problem? –  Frion3L Jul 1 '12 at 11:34
    
You're using ssh2 and not scp or sftp according to what you wrote above, and the path syntax doesn't match what I put here –  Mat Jul 1 '12 at 11:36
    
Oh, that's right. I meant scp. I wrote bad here, but in the console was right. That's not the problem –  Frion3L Jul 1 '12 at 11:37
    
Your path syntax is still wrong. –  Mat Jul 1 '12 at 11:37
    
I think the problem is with the path of the windows file... I don't know how to put it. –  Frion3L Jul 1 '12 at 12:10

Your Answer

 
discard

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