I have two machines with Ubuntu 14.04, right next to each other. But no network ((W)LAN). Can I transfer data from one machine to the other via usb-cable? And if so, how?

  • No, I don't think so. You'd need something called "bridged cable" for that. Apr 17 '17 at 19:07
  • In general, no. USB was designed to be PC-to-peripheral. We've blurred the definition of peripheral with tablets and phones, but you can't plug a plain old USB A-to-A cable from PC-to-PC. I don't believe I've ever seen an A-to-A cable aside from the Windows Easy Transfer Cable. Apr 17 '17 at 21:41
  • 2
    What has been said is true for ordinary PC's, though strictly speaking "Ubuntu 14.04" does not identify hardware, and there may well be builds that run on various quasi-embedded platforms or tablets that have USB device or OTG interfaces, as well as the USB host interfaces common on PC's. Apr 17 '17 at 21:45
  • 1
    This has been answered at superuser.com/a/1165890/41259 .
    – chx
    Apr 18 '17 at 1:40

When you say, USB cable you are referring to a Windows Easy Transfer Cable, right?

enter image description here

In that case, the easiest way to do this is to just hook the two machines directly together with an Ethernet cable. Modern NICs are smart enough that you don't even need a crossover cable; they just automatically crossover when they detect that you connected two computers.

  • 2
    From what I've heard, USB transfer cables as pictured are typically treated as a type of network in Linux anyway. Some ultralight laptops don't have wired ethernet jacks, so this could be advantageous - the option might be two USB-Ethernet adapters and an RJ45 patch cord (but though those could then be used for other networking purposes, too). Apr 17 '17 at 21:48
  • @ChrisStratton That's correct. These cables are essentially two NICs. Apr 17 '17 at 22:25
  • 1
    @DavidSchwartz in terms of how Linux traditionally treats them, yes. But Windows sees them completely differently (reportedly cross platform transfer does not work) and architecturally they are probably a pair of FIFOs and some logic sitting between two USB device engines, or even just coordinating logic to create virtual fifos out of a common buffer memory. Apr 17 '17 at 23:09
  • 2
    @ChrisStratton They're pretty much all based on some variant of the Prolific 2501 (2301, 25A1, whatever). Physically, there's two FIFOs between two backend controllers with a microcontroller for management. But that's essentially the same as what you'd get if you connected two NICs to each other. How the driver chooses to present it is, of course, the driver's choice. The same Windows software that works over these cables typically also works over back-to-back NICs unless the manufacturer chose to lock it down. Apr 17 '17 at 23:27
  • This, I believe, is the USB 2.0 answer with the USB 3.0 answer being at superuser.com/a/1165890/41259 .
    – chx
    Apr 18 '17 at 1:42

If you absolutely had to do this for a proof of concept you could simulate the ancient art of "laplink" transfers by emulating a serial port on each machine.

Usb to serial on one, and usb to serial (null modem) in the other, sorting out gender issues in the middle.

It would not be quick.

  • 8
    "It would not be quick."
    – Charlie
    Apr 18 '17 at 7:31

Firewire might also be an option. https://help.ubuntu.com/community/EthernetOverFirewire


If your machines have either a Type-B or On-the-Go connector, you can use the USB Gadget Driver. To load the driver

# modprobe g_ether

You can configure the MAC addresses and the vendor and product IDs:

# modinfo g_ether
filename:       /lib/modules/version/kernel/drivers/usb/gadget/legacy/g_ether.ko
license:        GPL
author:         David Brownell, Benedikt Spanger
description:    RNDIS/Ethernet Gadget
srcversion:     5E4C828D24F6E477C9CB5EE
depends:        libcomposite,u_ether,usb_f_rndis
intree:         Y
vermagic:       version SMP mod_unload modversions 
parm:           idVendor:USB Vendor ID (ushort)
parm:           idProduct:USB Product ID (ushort)
parm:           bcdDevice:USB Device version (BCD) (ushort)
parm:           iSerialNumber:SerialNumber string (charp)
parm:           iManufacturer:USB Manufacturer string (charp)
parm:           iProduct:USB Product string (charp)
parm:           qmult:queue length multiplier at high/super speed (uint)
parm:           dev_addr:Device Ethernet Address (charp)
parm:           host_addr:Host Ethernet Address (charp)
parm:           use_eem:use CDC EEM mode (bool)

You can set module parameters when loading the driver by passing them after the module name:

# modprobe g_ether host_addr=00:dc:c8:f7:75:05 dev_addr=00:dd:dc:eb:6d:f1

If neither of your machines support operation as a USB device, this approach will not work.

Warning: DO NOT attempt to connect two USB Type-A connectors. At best, you may damage your motherboards. At worst, you may start a fire.

  • there is a perfectly safe and logical reason for connecting two Linux computers by a USB A-to-A cable. That is to set up a kernel dubug port. kernel.org/doc/html/v5.4/driver-api/usb/usb3-debug-port.html This has been part of the USB spec for nearly a decade. It would be nice to see this feature be used more generally, as in outside of just a kernel debug port. The hardware is there, much of the software is there as well, if we get people used to the idea of using USB to USB connections for more than debug then maybe I'll stop seeing people ask this same question.
    – MacGuffin
    Sep 13 '20 at 2:06
  • That only applies to USB 3.0. While it may be part of the spec, I still haven't seen a USB 3.0 A-to-A cable in real life. And this is absolutely dangerous with a USB 2.0 A-to-A cable. Sep 13 '20 at 6:36
  • If we are going to step into the realm of suggesting USB gadget drivers then to be comprehensive, or perhaps annoyingly pedantic, then we should consider USB 3.x A-to-A cables, which has been part of the USB spec since 2010, and USB-C, which has been part of the spec since 2014. Most any computer made in the last 5 years should support USB 3.x, have USB-C ports, or both, and therefore be capable of data transfer from computer to computer by USB. The problem I'm seeing is finding the correct settings and drivers among the outdated USB 2.0 gadget information that is in abundance on the web.
    – MacGuffin
    Sep 14 '20 at 7:11

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.