Plug in a cable, click once, and two Linux computers can see each other's files.
No router, no IP addresses, no passwords, no server setup.
- Start DirectShare on both computers.
- Connect them directly with an Ethernet cable, or with a USB-C cable if both have USB4/Thunderbolt ports. That's ~4x faster. No switch or router needed.
- On one computer, click Share files.
- The other computer shows a popup. Check that both screens show the same code, then click Accept.
- Each computer now has the other one's entire file system mounted at
~/DirectShare/<other-computer>. It also shows up in the file manager's sidebar, and every program can use it like a local folder.
You get the same access as the user signed in on the other computer: whatever they can read or change, you can read or change, and nothing more. Click Stop sharing, close the app or unplug the cable, and both sides unmount right away.
| Looking for a peer | Peer found | Waiting for the other side |
|---|---|---|
![]() |
![]() |
![]() |
| The popup on the other computer | USB-C fast mode (dark theme) |
|---|---|
![]() |
![]() |
git clone https://github.com/KsmBl/directshare.git
cd directshare
./install.sh # installs for your user into ~/.local and offers to install missing packages./install.sh --system installs for all users into /usr/local (uses sudo). ./install.sh --no-deps
skips the dependency check.
| What | Arch | Debian / Ubuntu | Fedora |
|---|---|---|---|
OpenSSH server binary (sshd) |
openssh |
openssh-server |
openssh-server |
| sshfs + FUSE 3 | sshfs |
sshfs |
fuse-sshfs |
| PyQt6 + Qt SVG | python-pyqt6 qt6-svg |
python3-pyqt6 libqt6svg6 |
python3-pyqt6 qt6-qtsvg |
| iproute2 | iproute2 |
iproute2 |
iproute |
DirectShare only uses the sshd program. It never enables or reconfigures the system SSH
service, and it doesn't need root.
You can also run it straight from the source folder without installing it: python3 -m directshare.
./uninstall.sh # remove the program
./uninstall.sh --purge # also remove the host key, network profiles and sidebar bookmarksAdd --system if you installed with --system.
sequenceDiagram
participant A as Computer A
participant B as Computer B
Note over A,B: cable plugged in, both get IPv6 link-local addresses (fe80::) automatically
A-->>B: UDP beacon (multicast ff02::d5, port 47820)
B-->>A: UDP beacon
A->>B: "Share files": request + one-time key + verification code (TCP 47821)
Note over B: popup, user clicks Accept
B->>A: accept + B's one-time key
Note over A,B: each side starts a private SFTP server, running as the signed-in user
A->>B: sshfs mount of B's "/" at ~/DirectShare/B
B->>A: sshfs mount of A's "/" at ~/DirectShare/A
Note over A,B: share lasts as long as the control connection does
- No network setup. Every Linux machine gives a cabled interface an IPv6 link-local address
(
fe80::…) as soon as the cable is plugged in, without DHCP. DirectShare finds the other machine with link-local multicast and connects over those addresses. Nothing is routed, so nothing leaves the cable. - Exactly the remote user's permissions. Each computer starts its own
sshdas the signed-in user (not as root), so the peer can do exactly what that user can do. A normal user can't read/root, so neither can the peer. - Works with every file manager. The share is a regular FUSE mount (
sshfs) inside your home folder: Nautilus, Dolphin, Thunar, Nemo, PCManFM, terminal tools and file dialogs all see it. GTK file managers also get a sidebar bookmark. - Why SFTP instead of SMB? The share behaves like a mounted network share, but a Samba server needs root, a user/password database and system configuration, and mounting SMB needs root or gvfs (which Dolphin, for example, doesn't use). SFTP can run fully unprivileged, uses one-time keys instead of passwords, and gives exactly the signed-in user's permissions.
- Nothing happens until a person on the other computer clicks Accept, and Decline has the keyboard focus so a stray Enter doesn't share your disk.
- Both screens show a 6-digit verification code derived from the requester's one-time key.
- Each session uses fresh ed25519 keys. Password login is disabled, the servers only speak SFTP (no shell, no port forwarding), only accept the one key from this session, and only listen on the cable's link-local address. Host keys are pinned during the handshake, so there's no "trust this host?" prompt to click through.
- The control port only answers peers on a wired interface's link-local network. Requests from Wi-Fi or routed networks are dropped.
- Everything ends when the session ends: keys are deleted, servers stopped, mounts removed.
- Over USB-C/Thunderbolt the transfer isn't encrypted, for speed. See fast mode for why that's safe on a point-to-point link.
| Problem | Fix |
|---|---|
| "Cable connected, waiting for address…" doesn't go away | Click Set up link. It creates a private NetworkManager profile DirectShare <iface> that uses link-local addresses and doesn't wait for DHCP. |
| The other computer never shows up | A firewall is probably blocking it. Allow the cable interface, e.g. sudo ufw allow in on enp3s0 or sudo firewall-cmd --zone=trusted --change-interface=enp3s0. Ports used: UDP 47820, TCP 47821–47831. |
| Wi-Fi turns off when the cable is plugged in | That's not DirectShare, it's usually TLP (DEVICES_TO_DISABLE_ON_LAN_CONNECT), a BIOS "LAN/WLAN switching" option or a NetworkManager dispatcher script. On Dell laptops it's the BIOS option "Control WLAN radio", which you can turn off from Linux: echo Disabled | sudo tee /sys/class/firmware-attributes/dell-wmi-sysman/attributes/WlanAutoSense/current_value, then reboot. Run tools/diagnose-wifi-drop.sh: it checks the usual causes, watches what happens when you plug in the cable and names the culprit. |
| "This USB cable can't link the two computers" | A USB cable joins the two machines, but at least one has no USB4/Thunderbolt port. Both are USB hosts then and can't talk, whatever the cable is rated for (video output over the same port is a different mechanism). Use an Ethernet cable, a USB Ethernet adapter or a USB link cable. See Which cables work. |
| IPv6 is disabled | DirectShare needs IPv6 on the cable interface: sudo sysctl net.ipv6.conf.<iface>.disable_ipv6=0. |
A folder in ~/DirectShare says "Transport endpoint is not connected" |
A crashed session left a stale mount. Starting DirectShare again cleans it up, or run fusermount3 -uz ~/DirectShare/<name>. |
| Old network card without auto MDI-X | Very old 100 Mbit cards need a crossover cable. Anything from the last 15 years works with a normal cable. |
Logs of the file server for a running session are in $XDG_RUNTIME_DIR/directshare/session-*/sshd.log.
The android/ folder has a DirectShare app for Android phones (Android 8+). The phone
and the PC use the same protocol, so the phone shows up on the PC like any other computer:
- The phone's files on the PC: the phone's storage (photos, downloads, documents, everything
under "Internal storage") is mounted at
~/DirectShare/<phone>like any other share. - The PC's files on the phone: the PC shows up in the system Files app and in every app's "open file" dialog, with two entries: Home folder and Whole computer.
- Same accept popup with a verification code, as a notification and in the app.
Connecting: plug the phone into the PC with a normal USB cable (USB-A↔C or C↔C), then turn on USB tethering on the phone (the app has a button that opens the setting). A USB Ethernet adapter on the phone with a network cable works too. Over USB 2.0 expect ~30–40 MB/s.
Limits compared to the Linux app (Android rules, not DirectShare's):
- The PC sees the phone's user storage, not app data or system files. That would need root.
- On the phone, the PC's files are reachable through the Files app and file pickers, not as a folder path. Apps that read raw paths can't see them, since normal apps can't mount file systems on Android.
- While USB tethering is on, the PC may send its internet traffic through the phone's mobile data.
To keep internet on Wi-Fi/LAN:
nmcli connection modify "<phone's wired connection>" ipv4.never-default yes ipv6.never-default yes.
Install: build the APK (needs JDK 17+ and the Android SDK) and install it with adb, or copy it to the phone:
./buildAPK.sh # -> DirectShare-<version>.apk in the project folder
adb install -r DirectShare-*.apkOn first start, allow access to all files (so the PC can see your storage) and notifications (for share requests).
| Cable | Works? | Speed |
|---|---|---|
| Ethernet cable between the built-in ports | yes | ~115 MB/s (1 Gbit/s) |
| Ethernet cable + USB Ethernet adapter on one or both sides | yes, any adapter Linux supports | ~35 MB/s (USB 2.0 adapter), ~115–280 MB/s (USB 3, 1–2.5 Gbit/s) |
| USB host-to-host bridge cable (Prolific PL25A1 for USB 2.0, PL27A1 for USB 3.0) | yes, shows up as "USB link cable" | ~35 MB/s (USB 2.0), a few hundred MB/s (USB 3.0) |
| USB-C ↔ USB-C, both with USB4/Thunderbolt | yes, fast mode | ~2 GB/s on a 20 Gbit/s link |
| Plain USB cable (A↔C, C↔C, A↔A) between two PCs | no | – |
Why a plain USB cable can't work: USB always pairs one host with one device. PCs are
hosts, and USB has no host-to-host mode, so the two machines can't talk over a plain cable, no
matter what software runs on them. (A phone works because it switches to device mode; PC ports
almost never can. Check with ls /sys/class/udc: if that folder doesn't exist, the PC can't be a
USB device.) Bridge cables solve this with a chip in the middle that acts as the device for both
sides. Look for "USB data link" or "host-to-host" cables with a Prolific PL25A1/PL27A1 chip: the
Linux plusb driver handles them automatically.
On a laptop, a USB Ethernet adapter has one more advantage: some laptops (e.g. Dell's "Control WLAN radio") switch Wi-Fi off when the built-in Ethernet port gets a link, but don't watch USB adapters.
If both computers have USB4 or Thunderbolt 3/4 ports, connect them with a USB-C cable.
The kernel's thunderbolt-net driver turns the cable into a network link (thunderbolt0),
DirectShare shows it as USB-C, and the share runs in fast mode.
Over Ethernet the 1 Gbit/s cable is the limit (~115 MB/s). A Thunderbolt link carries 20–40 Gbit/s, so there SSH encryption becomes the bottleneck. Fast mode skips it. Measured between two network namespaces on an i7-13850HX, reading and writing a 3 GB file through the mount:
| Transport | Read | Write |
|---|---|---|
| SSH, OpenSSH default cipher (chacha20) | 491 MB/s | 640 MB/s |
| SSH, AES-128-GCM (what DirectShare uses over Ethernet) | 854 MB/s | 773 MB/s |
| Fast mode (USB-C) | ~2000 MB/s | ~1400 MB/s |
How fast mode stays safe without encryption:
- It's only used when both sides see the link as USB-C. A Thunderbolt link connects exactly two computers, so there's nobody in between to listen. Over Ethernet (which could go through a switch) DirectShare always uses SSH. A peer can't talk the other side into fast mode, because each side checks its own link type.
- The file server only accepts connections from the peer's address on that cable, and the peer has to present a random 256-bit one-time token sent over the handshake. Other users logged into the peer computer don't have the token, so they get nothing.
- After the token check the socket is handed straight to
sftp-serveron one side and tosshfson the other. No process copies the data in between. - Access rights are the same as in SSH mode: the server runs as the signed-in user.
Requirements: USB4 or Thunderbolt 3/4 ports on both computers (check with
ls /sys/bus/thunderbolt/devices: you need a domain0), a USB4/Thunderbolt-rated USB-C cable
(a USB 2.0 charging cable won't do), and a kernel with thunderbolt_net, which every
mainstream distribution has. Plain USB-C ports without USB4/Thunderbolt can't connect two computers.
If the USB-C row stays at "No computer connected" after plugging in: check that the cable is a
data cable, try sudo modprobe thunderbolt_net, and look at dmesg | grep -i thunderbolt.
Some BIOSes have a "Thunderbolt security level" or "Thunderbolt networking" setting. Host-to-host
networking needs it allowed.
directshare/
links.py cable detection (LinkProvider per cable type) and link setup via NetworkManager
discovery.py link-local multicast beacons
engine.py control protocol and session lifecycle
sharing.py unprivileged sshd, sshfs mounts, file manager bookmarks
gui.py Qt interface
tests/
e2e_netns.sh end-to-end test: two instances in two network namespaces joined by a virtual cable
test_unit.py unit tests: fast-mode access control, cable detection
e2e_android_jvm.sh the Android app's engine (on the desktop JVM) against the Linux app
tools/
screenshots.py renders the README screenshots offscreen
android/
core/ protocol, discovery, engine, SSH/SFTP (Kotlin, no Android dependencies)
app/ Android UI, foreground service, Files-app provider
jvmpeer/ headless desktop build of the engine for the end-to-end test
Unit tests:
python3 -m unittest discover -s testsRun the end-to-end test. It needs sudo only to create the network namespaces, and it covers accept, decline, USB-C fast mode, the fallback to SSH and a pulled cable:
tests/e2e_netns.shAndroid: ./gradlew :core:test (SSH interop with the real sshfs/sshd),
./gradlew :jvmpeer:installDist && ../tests/e2e_android_jvm.sh (phone engine ↔ Linux app), and
./gradlew :app:connectedDebugAndroidTest on a device or emulator (SSH stack and Files-app provider on Android).
Regenerate the screenshots:
python3 tools/screenshots.py && python3 tools/screenshots.py --darkDIRECTSHARE_HOME=<dir> moves all state and mounts into <dir>, and DIRECTSHARE_IFACES=if1,if2:usb-c
picks the interfaces to use and optionally their cable type. Both are meant for testing.








