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?
When you say, USB cable you are referring to a Windows Easy Transfer Cable, right?
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.
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.
Firewire might also be an option. https://help.ubuntu.com/community/EthernetOverFirewire
# 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.