Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to send files to a server using ssh. I have never used ssh so this is frustrating to me. I am running Windows and the server is running Ubuntu.

I connected to the server using ssh2 IP, and then logging 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

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 specify more and added: C:\test.txt, but appear the same error. I don't know what is happening.

Any hints please?

share|improve this question

migrated from Jul 2 '12 at 6:32

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

"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
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

You must log in to answer this question.