How can I SSH into another computer over USB?

5,199

Solution 1

There are a number of USB to USB bridge cables for connecting two computers together that will provide a 5 Gbps network, much like an Ethernet cable would. They are all based on the Prolific 27A1 or similar chip. I have such a cable but haven't yet set up two Ubuntu machines for testing the situation you describe. When I plug one end of the cable into the Ubuntu computer it is immediately recognized as a network adapter. When I plug it into a Mac or Windows computer it is not seen as a network adapter.

An educated guess is that such a cable would provide an IP connection between two Ubuntu computers suitable for an SSH session once set up properly. Perhaps this is an option you could consider. I'll see if I can make the time to do some testing myself soon and follow up here.

There's a number of people that offer such a cable and they will be called an "easy transfer" cable or something similar. I got mine from Startech but it looks like Belkin, LapLink, and other similar places offer a similar or functionally identical cable. If they are open and honest about what is inside the cable then you should be able to see that it is based on the Prolific 27A1 chip. If not then it's still a similar chip by a different name or an older variant that is not nearly as fast, older as in based on USB 2.0 and not USB 3.x.

Solution 2

It is possible over serial.

Add a "serial over usb" cable to both machines. Then both machines have a serial port. Connect these two ports with a null modem cable. If the ssh server-side is listening on its serial port, the client can ssh via tty1. (if com port on client is 1.)

If one ore more machines already have a serial port its easier and the null-modem-cable might be the only thing you need.

Share:
5,199

Related videos on Youtube

Jack M
Author by

Jack M

Updated on September 18, 2022

Comments

  • Jack M
    Jack M almost 2 years

    I have a mini PC running Ubuntu server 20.04. I also have a laptop running Ubuntu desktop 20.04. I want to set up the mini PC so that if I connect a USB cable from it to my laptop, I can SSH into it from the laptop. The idea is to be able to configure the mini PC (which I'm going to use as a server) if its network connection goes out without having to connect a monitor and a keyboard to it.

    Is this possible?

  • raj
    raj over 3 years
    Ethernet over USB cables (instead of serial over usb) would be a better solution. You would have a real, working network connection.
  • Jack M
    Jack M over 3 years
    An Ethernet-Over-USB solution is what I was thinking of, but I didn't realize you needed a special cable. I used to do Ethernet-Over-USB to connect a standard computer to a custom Android device, but I suppose that must have relied on special hardware/software on the Android device.
  • MacGuffin
    MacGuffin over 3 years
    Ideally you would not need a special cable. USB 3.x allows for host to host connections in it's spec. There's documentation for how to do this for things like Linux kernel debugging but not as a general purpose communications link. There's also the USB "gadget" project/driver/whatever that allows a host PC to act as a USB device. Not all USB 3.x chips support this function but most common ones do. The use of a USB-C port to charge a laptop relies on the ability to act as a USB device to a USB-PD compatible charger host. Without the right software there's still a hardware solution.