Skip to content

Instantly share code, notes, and snippets.

@yarwelp
Last active March 4, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yarwelp/7d4df7d7eadeca817596 to your computer and use it in GitHub Desktop.
Save yarwelp/7d4df7d7eadeca817596 to your computer and use it in GitHub Desktop.
Proper configuration of samba server and client

Proper configuration of samba server and client

This is how I share directories from my main desktop computer at home running Fedora 23 with another computer I have at home running Lubuntu 14.04 LTS. That is to say, the former acts as server and the latter acts as client. As shown here, I also have a couple of public directories for exchanging files with anyone on the home network.

While configuring samba server and client, I found the official docs a bit difficult to comprehend with regards to a few things but when I went online to look at how others were doing, the quality of many of the guides and discussions I found were not very good so I wrote down what I did to get a proper setup.

Assuming your username is erikn, the hostname of the server is cubi, that /home/erikn/Storage/ is the directory you want to share unlisted, read-only, with authenticated clients, that you want /home/erikn/Storage/Public/ to be public, read-only, guest-only and that you want /home/erikn/Storage/Public/Incoming/ to be public, read-write, guest-only, these instructions show what to do. Modify as needed.

On server, execute

mkdir -p ~/Storage/Public/Incoming/
sudo smbpasswd -a erikn
sudo dnf install policycoreutils-python-utils
sudo semanage fcontext -a -t samba_share_t "/home/erikn/Storage(/.*)?"
sudo restorecon -R -v /home/erikn/Storage/

Update /etc/samba/smb.conf of server as per attached file.

Update /etc/fstab of client as per attached file.

On client, execute

sudo mount -a

That's it, we're done :)

# /etc/fstab
# Configuration of client -- excerpt with portions relevant to SMB only
//cubi/Storage /media/Storage cifs username=erikn,password=REDACTED,uid=nobody,gid=nogroup,iocharset=utf8,sec=ntlm,noexec,nosuid,nodev,ro 0 0
//cubi/Public /media/Storage/Public cifs guest,uid=nobody,gid=nogroup,iocharset=utf8,sec=ntlm,noexec,nosuid,nodev,ro 0 0
//cubi/Incoming /media/Storage/Public/Incoming cifs guest,uid=nobody,gid=nogroup,iocharset=utf8,sec=ntlm,noexec,nosuid,nodev,rw 0 0
# /etc/samba/smb.conf
# Configuration of server -- complete
[Storage]
path = /home/erikn/Storage
browseable = no
valid users = erikn
[Public]
path = /home/erikn/Storage/Public
guest ok = yes
guest only = yes
[Incoming]
path = /home/erikn/Storage/Public/Incoming
guest ok = yes
guest only = yes
writeable = yes
force create mode = 0666
force directory mode = 0777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment