How to set up network file sharing on Linux over USB-C

Linux desktops do not share folders over a Thunderbolt or USB4 cable out of the box. Sharing from Ubuntu, Fedora, or Arch means setting up the thunderbolt0 link, IPv4 address, Samba config, password, and firewall by hand.

Share folders from your Linux computer

Follow these six steps on the Linux machine whose files you want to share over a USB4 or Thunderbolt cable:

  1. Check that Thunderbolt networking is active (lsmod | grep thunderbolt_net; if missing, run sudo modprobe thunderbolt thunderbolt_net) and verify the other computer is authorized (cat /sys/bus/thunderbolt/devices/*/authorized should return 1).
  2. Check ip addr show thunderbolt0 for an IPv4 address.No normal IP address by defaultLinux often brings thunderbolt0 up with only an IPv6 address (fe80::) and no 169.254 IPv4 address. Open Network Settings and set IPv4 to Link-Local Only, or set fixed IP addresses on both computers.
  3. Install Samba (sudo apt install samba on Ubuntu/Debian or sudo dnf install samba on Fedora) and edit /etc/samba/smb.conf to add your shared folder.Visible on Wi-Fi tooBy default, Samba listens on Wi-Fi and Ethernet too — not just the USB-C cable. To keep it cable-only, add interfaces = lo thunderbolt0 and bind interfaces only = yes under [global]. For Mac compatibility and clean permissions, also add vfs objects = fruit streams_xattr, create mask = 0664, directory mask = 0775, and inherit permissions = yes.
  4. Create a separate Samba password with sudo smbpasswd -a $USER (Samba ignores your normal Linux login password), then restart it (sudo systemctl restart smbd or smb).
  5. Allow port 445 strictly on the cable in your firewall: sudo ufw allow in on thunderbolt0 to any port 445 proto tcp (UFW) or sudo firewall-cmd --zone=trusted --add-interface=thunderbolt0 --permanent && sudo firewall-cmd --reload (firewalld).
  6. Breaks after sleepOn some Linux laptops, waking from sleep drops the Thunderbolt connection and freezes open shared folders until you rescan /sys/bus/thunderbolt/switches/0-0/rescan or unplug and replug the cable.

Connect from Linux (Files / Nautilus)

Follow these two steps on the Linux computer you want to copy files onto or browse from:

  1. Open your file manager (Files), press Ctrl + L, type smb://169.254.x.x, and press Enter.
  2. Choose Registered User and enter the other computer’s account name and real password (not a Windows PIN, and avoiding computer names that may route over Wi-Fi).

Also setting up the other computer?

If your second computer runs a different operating system, open its setup guide too — or read the main file-sharing overview for cross-OS security risks and speed limits:

Questions and answers

Does Linux Samba listen on Wi-Fi too when sharing over a Thunderbolt cable?

Yes, by default Samba listens on every network interface including Wi-Fi and Ethernet. To restrict it strictly to the USB-C cable, add interfaces = lo thunderbolt0 and bind interfaces only = yes under [global] in /etc/samba/smb.conf, and allow port 445 only on thunderbolt0 in UFW or firewalld.

Why does thunderbolt0 on Linux have no 169.254 IPv4 address?

NetworkManager often brings thunderbolt0 up with only an IPv6 link-local (fe80::) address. Open your desktop’s Network Settings for the Thunderbolt connection and set IPv4 to Link-Local Only (or assign matching static IPs on both computers).

Why doesn’t my normal Linux login password work with Samba?

Samba keeps its own separate password database and ignores your normal Linux account password until you create one with sudo smbpasswd -a $USER and restart smbd.