I am on Ubuntu 9.04 and am unable to scp files from my computer to a server. On the other hand, I am able to scp files from the server to my computer.

I suspect some ports are blocked on the the Router. If yes, what are they. Else, could there be any other problem.

EDIT: Today I bypassed the router and connected the broadband cable directly to the computer, and am not having any problem. However, if I connect via the router - I am faced with the above problem.

  • Are SSH running on both machines? On router, first try to switch off any filters you may have. Then tell the result, maybe we will figure something out. – Andrejs Cainikovs Sep 21 '09 at 8:20
  • Can you ssh from your computer to your server? Try running scp with the -v option to show more debugging information. Adding more will increase debug information -vv, -vvv (up to three). – Doug Harris Sep 21 '09 at 17:25
  • Yes, I am able to SSH to the server. – Susheel Javadi Oct 14 '09 at 18:28
  • make/model of the router? – quack quixote Oct 14 '09 at 18:56

One of the simplest ways to discover if the port is open on the target machine is to simply telnet to the port. You should get an SSH header message in return. For example:

telnet remote.machine 22
  • locke, the problem is not that ports are closed on the target machine. Because, I am able to scp files if I do not connect to the server via the router. – Susheel Javadi Oct 14 '09 at 18:44

I'd say it's unlikely to be a port issue since you can establish the connection, it's more likely to be a permissions issue on the folder you're copying to.

  • Not true. At my job, for example, I can connect to remote imap server, but not to imaps, because router analyzes packets and some ports are not in a whitelist. – Andrejs Cainikovs Sep 21 '09 at 8:36
  • But the fact that he can scp one way means the ports for scp are open doesn't it? Although I'm not sure whether he means he can use the scp client on his pc to copy the stuff one way and not the other or if he means he runs scp on the server to do the copy one way and on the client to do it the other way. – Col Sep 21 '09 at 9:32
  • Col - I do have permissions to copy to the destination - it is my home directory (on a *nix machine). – Susheel Javadi Oct 14 '09 at 18:27

It's apparently possible to allow SSH while blocking SCP. I wrote it up in an answer to another question:

The trick is in the authorized_keys file format. There are several options that allow the server to restrict SSH features based on what key was used to authenticate. The "command=" option allows the server administrator to attach a restriction on the public key -- something like stating that "any incoming connections that authenticate with this key will execute this command, regardless of what command might have been requested by the user".

I haven't tested this out, but that could explain why you can't get through to the server with SCP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.