User Tools

Site Tools


Network Sharing for Linux Machines

Install Support for Windows Shares

Ubuntu, etc:

sudo apt-get install cifs-utils


sudo pacman -S smbclient

Create a Credentials File

  • nano ~/.smbcredentials to create the file in your home directory
  • add:
    • username=msusername
    • password=mspassword
    • domain=workgroup
  • Secure the file with: chmod 600 ~/.smbcredentials
  • Add the alternate line to the FSTAB

Create Mount Points

  • Pick any directory
  • Recommend /home/rich/MOUNTNAME
  • mkdir /home/rich/NAS_Public
  • mkdir /home/rich/NAS_Rich


The FSTAB, or File System Table defines what is mounted where in linux. The following setup mounts two network shares:

sudo gedit /etc/fstab
  • Add the following lines to the bottom of the file:
#Section Below Mounts NAS Drives
//\040Home\040Public /home/rich/NAS_Public cifs gid=100,credentials=/home/rich/.smbcredentials,sec=ntlm,rw,dir_mode=0775,file_mode=0775 0 0
//\040Home\040Personal /home/rich/NAS_Rich cifs gid=100,credentials=/home/rich/.smbcredentials,sec=ntlm,rw,dir_mode=0775,file_mode=0775 0 0
  • In ArchLinux, security is forced to ntlm and the group id is set to 100. The dir_mode and file_mode options allow group read-write-execute permissions. This allows users in the “users” group to access the shares.
  • The gid=100 must be placed before the credentials entry.

Remount Everything

  • sudo mount -a

Mounting Concerns

Systems that boot quickly sometimes mount entries from fstab prior to the network being “up.” In order to make sure the network is up before you fstab is run, run the following command:

sudo systemctl enable systemd-networkd-wait-online.service

When running OSMC, the above method doesn't seem to be sufficient. If this does not fix mounting errors, try adding the following options to the FSTAB line:


My understanding is that these options do the following:

  • noauto- prevents the mount points from being mounted automatically at boot
  • x-systemd.automount- enables mounting of the shares when they are first requested

Here's what a final line should look like:

//\040Home\040Public /home/osmc/NAS_Public cifs gid=100,credentials=/home/osmc/.smbcredentials,noauto,x-systemd.automount,sec=ntlm,rw,dir_mode=0775,file_mode=0775 0 0

Setting up XBMC Network Share

Browse to /home/pi/.xbmc/userdata/sources.xml

Sources should look like this:

<path pathversion="1">smb://username:pwd@yournasip/yoursharename/folderyouwant</path>

Network Sharing for Windows

To map a network drive:

  1. Open an explorer window and type “\\” in the address bar and press enter
  2. Right click on the folder to be mapped and select “Map Network Drive”
  3. Follow instructions.

To save credentials for automatic login:

  1. Open the Windows Credential Manager
  2. “Add a Generic Credential”

Samba Server for Linux

These instructions are for ArchLinux

  • Install Samba: sudo pacman -S samba
  • Configure samba
    • Copy original: sudo cp /etc/samba/smb.conf.default /etc/samba/smb.conf
    • Edit configuration: sudo nano /etc/samba/smb.conf
  server string = Seedbox Server
  workgroup = WORKGROUP
  security = user
  map to guest = Bad User
  guest ok = yes
  guest account = nobody
  printing = bsd
  printcap name = /dev/null
  public = yes
  writable = yes
  create mask = 0775
  directory mask = 0775
  • Verify file using: testparm smb.conf
  • In order for files created to readable by group members:
    • Run: sudo chmod g+s Directory
    • Run: sudo chgrp users Directory
  • Start and enable samba and nmbd
    • sudo systemctl start smbd.service
    • sudo systemctl start nmbd.service
    • sudo systemctl enable nmbd.service
    • sudo systemctl enable nmbd.service
    • Check status: sudo systemctl status ssmbd.service
    • Check status: sudo systemctl status nmbd.service
  • You may need to leave the homegroup on Windows Machines
  • Check Samba logs for errors and usage: var/log/samba
  • To use guest access, you must set guest account to “nobody”, which is an actual user.
network_setup.txt · Last modified: 2016/01/18 21:29 by admin