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.
- Using terminal, run: sudo dnf install -y samba samba-client
- If you want Samba server to startup automatically at boot, run sudo systemctl smb nmb enable
- Add an entry into the firewall to allow access from other systems on the network: firewall-cmd –add-service=samba –permanent
- Reload the firewall service: firewall-cmd reload
- Allow home directory access for local users in SELinux: setsebool -P samba_enable_home_dirs on
- 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.
- Next restart the smb and nmb services to load changes made to Samba: sudo systemctl restart smb nmb
- 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:
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.