Maximum PC

Adding Samba

Get ready to dance to the sharing protocol with extra bossa nova

-

ONE OF THE MOST noble duties any home server can perform is sharing files. Whether it’s to store the gigabytes of bangin’ psytrance tunes you’ve amassed, or just a place to put things when you can’t find a USB stick to throw at your cohabiters, having some central and communal storage space is incredibly useful. Unixlike OSes have their own file sharing protocol called NFS, which has been around since the 80s.

This is certainly an option, but not one we’ll indulge today. Instead, we’ll use Samba, which is an implementa­tion of the sharing protocols used in Windows. This has the advantage that our server will be accessible to any Windows machine or Mac, as well as any iOS or Android devices.

Before we set up Samba, it’s a good idea to set up some directorie­s for the network shares first. We’ll store them on our RAID, which should be auto-mounted if you’ve rebooted since setting it up. If not, mount it now with

# mount /mnt/mpcraid . Let’s make those directorie­s:

# mkdir /mnt/mpcraid/{music,public,docs}

We’re going to allow anyone read access to all of these, and we’ll also enable anyone to write to the public directory. If you have some music or documents that you feel other network users would benefit from, then now is a good time to populate those directorie­s. Samba shares can be set up with user and password access, but for a home network, it’s simpler to allow guest access to your shares. This means we’ll have to make the public directory world writeable with # chmod 777 /mnt/ mpcraid/public .

Now we’ll # apt-get install samba and set up our shares. Edit the /etc/samba/smb.conf file, and add the following lines in the Share Definition­s section:

[public] path = /mnt/mpcraid/public read only = No browsable = Yes guest ok = Yes

Now restart the service with # systemctl restart smbd . You should be able to browse the server by navigating to smb://192.168.1.100 from any file manager (this syntax also works on Mac; for Windows, use \\192.168.1.100). From Linux machines, you can mount the share via the command line (so long as the cifs-utils package is installed):

# mount -t cifs //192.168.1.100/public /mnt/smbpublic/ -o user=guest

Make entries in /etc/samba/smb.conf for the music and docs shares, as we did with public. This time, omit the

guest ok line, and set read only to Yes (although it doesn’t really matter, since those directorie­s, for want of better phrasing, aren’t writable by nobody ).

Any files deposited will be owned by the nobody user, which is where Debian maps Samba’s guest user to. Windows 10 is morally opposed to accessing guest shares; the procedure to persuade it to be otherwise is explained at https://techjourne­y.net/cannot-connectto- cifs-smb-samba-network-shares-shared-foldersin-windows-10. User-level security (of which Windows 10 approves) is reasonably easy to set up, too, which enables private network shares to be set up. The Samba credential­s can be synchroniz­ed with user accounts on the server, so this way you can (as described in smb.conf) privately share your home directory over the network.

If you run into problems configurin­g Samba (and you wouldn’t be the first), the testparm program can often provide a useful diagnosis. SMB failure messages are not known for their usefulness.

 ??  ?? PCManFM prompts you for either guest or user access to network shares.
PCManFM prompts you for either guest or user access to network shares.

Newspapers in English

Newspapers from United States