ssh successful but not scp? why?

0

I am trying to automate the file transfer between server and the local machine, which I was able to do it on laptop running windows 7 as well as Ubuntu. Now trying to implement it on the local desktop machine running windows server 2003, by installing cygwin. I am able to transfer files via

scp 

the errror message got using the following command is as below.

 $ ssh -vvv test username@example.se:~/?
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug2: ssh_connect: needpriv 0
debug1: Connecting to test [11.22.33.44] port 22.
debug1: connect to address 11.22.33.44 port 22: Connection timed out
ssh: connect to host test port 22: Connection timed out

some help would be appreciated. I do not understand, why i am unable to since server settings must be ok as I was able to transfer files using scp from my laptop. what can be the reason. some help needed immediately if possible. thanks.

tough

Posted 2012-07-10T15:41:34.003

Reputation: 143

Is this question mark really part of your command line or is it just a typo? (here: $ ssh -vvv test username@example.se:~/?) – Claudio – 2012-07-10T16:19:49.050

Can you ping the IP address of the server? Can you run a trace route to it? – Zoredache – 2012-07-10T16:38:39.490

Answers

0

This error shows you couldn't connect to the server. That can have many reasons:

  • a firewall blocking incoming connections to your server
  • a firewall blocking outgoing connections from your computer
  • ssh daemon on the server configured to listen on a non-standard port
  • stopped ssh daemon

Since you can transfer files from your other computer I'd say you probably have a firewall blocking the connection. By the way... I supposed this host "test" is just a hypothetical example you used. Note it's IP address is not a valid local address (11.22.33.44), so if this message is real you should try using the server's IP address in place of "test".

Claudio

Posted 2012-07-10T15:41:34.003

Reputation: 556

I agree that IP is just some numbers instead of the actual IP, ssh daemon on the server configured to listen to the non standard port ! "I was able to ´scp´ from my laptop with same config in server." yes I can ping to the server, its ok with 0 packet loss. Question mark was part of the command which resulted the output files above. I saw it in some posts and used it did not know exactly what it does. – tough – 2012-07-10T16:54:38.353

If the server is configured to listen on a non-standard port you have to specify it on the command line. Suppose the port you are using is 2222. Then you should use this for ssh: ssh -p2222 user@server. Note that for scp the switch is a P instead of p: scp -P2222 file user@server:~/directory (supposing directory is under your homedir). – Claudio – 2012-07-10T17:13:38.110

as I have successfully connected via ssh, that must not be a problem with the port, could you please highlight on this. I am quite new so, detailed explanation would help me more. link says something about it but could not figure out on which side it is talking about client or the server side?

– tough – 2012-07-11T09:25:54.113

Now it seems that I can log in with ssh and do scp as well, don know what changes caused this. but it works, as far as i know my commands were not correct. – tough – 2012-07-11T11:46:32.010

@tough, if you post the commands you used for connecting successfully I can explain you why they worked. – Claudio – 2012-07-11T12:15:57.273

$ scp -v ~\.ssh\id_rsa.pub user@example.com:~/temp/ this worked. where temp is my folder where I store most of the sent files to process it later in server. The initial command were different which I tried trying different parameters which I do not remember correctly. seemed simple, later on but it was stupidity of me not to get the commands rights for this easy looking job as well. I am completely new to this so, I am sorry bothering so many of you. I don know most of the time I stuck with small problems, and in the office there is no one to guide me, still lots to learn. – tough – 2012-07-11T23:05:35.330

Just in case, linux commands usually have a comprehensive help you can access by typing man followed by the command in question (eg. man ssh). Very useful to check out which options you can use with a given command, and you can learn a lot reading it. Just in case, you can always post here too. That's the point of the site, helping solving problems, specially when it can benefit other people too.

Since you're new here, if you consider my answer helped you solve this problem you can help me too by checking the big checkmark to make it your chosen answer. – Claudio – 2012-07-12T04:28:45.950