Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to copy a file from one of my local machines to a remote machine. Copying a file with size upto 1405 bytes works fine. When I try to scp a larger file, the file gets copied but the scp process hangs up and doesn't exit. I have to hit Ctrl-C to return back to the shell.

I have observed the same behavior with FTP as well. Any ideas about what might be causing this?

share|improve this question

migrated from stackoverflow.com Jun 2 '11 at 0:23

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

5 Answers 5

up vote 20 down vote accepted

This definitely sounds like MTU problems (like Konerak pointed out´), this is how I would test this:

ip link set eth0 mtu 1400

This temporally sets the allowed size for network packets to 1400 on the network interface eth0 (you might need to adjust the name). Your system will then split all packets above this size before sending it on to the network. If this fixes the scp command, you need to find the problem within the network or make this ugly fix permanent ; )

share|improve this answer

Consider that the MTU is typically 1500 B (due to the limitations of ethernet). Of those 1500 B not all are used for 'data'. So-called protocol overheads take a hefty chunk out of the 1500.

  • SCP (uncompressed) requires a 65 B header.
  • TCP requires a 20-60 B header.
  • IP requires a 20-60 B header.

In light of this, it's not so surprising that your payload is limited to 1405 B.

I hope this helps.

P.s. Have a play with wireshark and check the IP headers. Are they allowing packet fragmentation?

share|improve this answer

Sounds like bad hardware to me. If it's only one machine on the LAN, it might have a bad Ethernet card; if it's all machines on the LAN, I'd check the hub or router.

share|improve this answer

Sounds like a bad router configuration, data packet transfer limit should be less amount I think

share|improve this answer

There is some kind of tunneling going on between the source and target machines involved. TCP will transmit an MSS when opening the connection (that will be used for ssh/scp), and this tunnels along the way (that add encapsulation, and thus reduce the maximum available MTU) should compensate by transparently modifying said MSS en-route to the destination (and vice versa).

Some tunnel (VPN?) is not doing its job. Or the MSS on your machine is misconfigured.

I am guessing you'll see the same behavior if you ssh to the machine from which you're trying to copy, and just do an ls in an empty dir. That should work fine. But if you "cd / ; ls -lR" (and thus get large packets), this will hang as well.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.2.26.2347\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group. <br>This site is not affiliated with Linus Torvalds or The Open Group in an"], "copyright__copyright__copyright": ["S on your machine is misconfigured.\n\nI am guessing you'll see the same behavior if you ssh to the machine from which you're trying to copy, and just do an ls in an empty dir. That should work fine. But if you \"cd / ; ls -lR\" (and thus get large packets), this will hang as well.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}