I have been wondering how all these small nas boxes that run linux can share over network and usb. The network part is totally under control, but I am completely at a loss on how I could hook up a computer to my server through USB cable, and get a share.

Is this done with some specific hardware or is this done through software ?


Both hardware and software. https://www.kernel.org/doc/htmldocs/gadget.html Although there are USB "cables" with NIC built in that allow two USB hosts to talk to each other (via the USB network adapter). Which is slow as network-over-usb has way more overhead than regular USB.


Most of the NAS' that I've encountered make use of Samba and then share these USB mounted disks out as Samba shares.

Rules like this can be put in your /etc/fstab file:

$ blkid
/dev/sda2: LABEL="OS" UUID="DAD9-00EF" TYPE="vfat" 

This line can be adapted to this:

/dev/sda2    /export/somedir ntfs    defaults            1 2

Once this USB drive is mounted at boot up, Samba can be used to share out /export/somedir.

# /etc/samba/smb.conf
  comment = Videos for Xbox
  path = /export/somedir
  browseable = yes
; available = yes
  guest ok = no
; read only = yes
  public = yes
  inherit permissions = yes
  writeable = yes
  hosts allow = 192.168.0. 192.168.1. localhost

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.