Setting up a Samba Server in Linux for Your Home Network

In this tutorial, we’ll setup a Samba share you can use to access files stored on a local system anywhere on the local network. We’ll also take it a step further by creating another share that is read only.

  1.  Using terminal, run: sudo dnf install -y samba samba-client
  2.  If you want Samba server to startup automatically at boot, run sudo systemctl smb nmb enable
  3. Add an entry into the firewall to allow access from other systems on the network: firewall-cmd –add-service=samba –permanent
  4. Reload the firewall service: firewall-cmd reload
  5. Allow home directory access for local users in SELinux: setsebool -P samba_enable_home_dirs on
  6. Create access for a user account already on your Linux system: pdbedit -a <user> where ‘user’ is the name of your local Linux user account you want to allow access to. Type in the password when prompted.
  7. Next restart the smb and nmb services to load changes made to Samba: sudo systemctl restart smb nmb
  8. Test access from another computer i.e.:  Windows – Launch Explorer, type \\  where ‘ip address’ is the IP of your Linux Samba server.

Adding a new share to Samba Server:

  • Edit smb.conf: vi /etc/samba/smb.conf  (You can also use Nano editor if it’s installed)
  • At the very bottom, insert a new section:

[new_share]

comment= New share on Fedora Server

path = /path/to/new/share/

read only = yes (no if you want to have write access)

guest only = no

guest ok = yes (no if you don’t want guests to have access)

share nodes = yes

  • We need to set another SELinux permission. This is very broad and not as secure as it should be. If you want to get more granular, put SELinux in permissive mode, access your new share, then read the SELinux error message that comes up*.
  • run sudo setsebool -P samba_export_all_ro 1
  • restart Samba: systemctl restart smb nmb

*For specific information on how to set a more granular SELinux entry for your specific share, check out this video on how to setup a Samba share on your home network.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s