19

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. – mikewhatever 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. – Christopher Hostage 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. – Chris Stratton Apr 17 '17 at 21:45
  • 1
    This has been answered at superuser.com/a/1165890/41259 . – chx Apr 18 '17 at 1:40
15

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). – Chris Stratton Apr 17 '17 at 21:48
  • @ChrisStratton That's correct. These cables are essentially two NICs. – David Schwartz 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. – Chris Stratton 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. – David Schwartz 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
3

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
1

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

0

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.

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.