How to setup Samba on Fedora the easy way?

I have to add this to the samba config file?

did you set up firewalld, also it’s a need to open port for samba, and please check disable selinux?

Copy both commands into the terminal under your session.
An unprivileged Samba user should have access to the whole directory chain recursively starting from the filesystem root.

Didn’t work.

Why is this so complicated?

Is there any GUI I could use instead?

Ok, let’s recap, I want to share the /home/myusername/Downloads folder so I could access it from a Windows 10 computer and an Android TV device, could someone please provide the step by step commands to make this work in one single reply?, thanks.

SMB_SHARE="$(xdg-user-dir PUBLICSHARE)"
sudo dnf install samba
sudo tee --append /etc/samba/smb.conf << EOF > /dev/null
path = ${SMB_SHARE}
guest ok = yes
writeable = yes
sudo systemctl --now enable smb.service
sudo firewall-cmd --permanent --add-service="samba"
sudo firewall-cmd --reload
mkdir --parents "${SMB_SHARE}"
chmod "u=rwX,g=rX,o=rX" "${SMB_SHARE}/.."
chmod --recursive "u=rwX,g=rwX,o=rwX" "${SMB_SHARE}"
sudo semanage fcontext --add --type "samba_share_t" "${SMB_SHARE}(/.*)?"
sudo restorecon -R "${SMB_SHARE}"
nautilus smb://localhost/public

Although have no Windows to test, it works for me on Fedora 30.


I don’t want to sound rude but… Where is the /home/myusername/Downloads folder in there???

To be able to understand what you are doing, I need to see those steps as if you were doing them in my computer…

Change the first line to whatever your share path is:


@vgaetera, as far as I know chcon changes SELinux context only temporarely:

Fedora’s user guide for SELinux says:

The chcon command changes the SELinux context for files. These changes do not survive a file system relabel, or the /sbin/restorecon command.

The same guide suggests using semanage fcontext for persisting changes, and that’s what I’ve always done.

Then you need to change this line:

chcon --recursive --type=“samba_share_t” “${SMB_SHARE}”


sudo semanage fcontext -a -t samba_share_t "${SMB_SHARE}(/.*)?"
sudo restorecon -Rv "${SMB_SHARE}"

Hi @delacosta78, this is how I do it:

  1. install samba

sudo dnf install samba`

  1. tell SELinux and Firewall that samba is OK

sudo setsebool -P samba_export_all_rw on
sudo firewall-cmd --add-service=samba --permanent
sudo firewall-cmd --reload`

  1. setup your share

cat<<EOF | sudo tee /etc/samba/smb.conf
workgroup = WORKGROUP
netbios name = DOWNLOADS
wins support = yes

comment = Downloads
path = /home/myusername/Downloads
read only = yes
guest ok = yes

  1. enable and start samba services

sudo systemctl enable smb
sudo systemctl start smb

I hope that helps.


Yes!, it worked! but I changed one thing, I didn’t use WORKGROUP but another word I use for my LAN.

I also removed the netbios name = DOWNLOADS to keep the name my computer already has.

Thank you so much, this is what I was looking for, an easy way to setup this, bummer there is not a GUI.

Basically you need:
writable = yes
create mode = 0644
directory mode = 0755

and you also need to remove:

read only = yes

Thank you for your reply, one last question though: What if I want to share more folders? should I add another line for each folder I want to share where “path=” is?

@delacosta78, you need to add another block like this for each of the folders you want to share (with settings specific to this share ).

Sections names (in square brackets) should be unique for each section / block, that’s the samba share name you see when connecting to this server, and all the settings that follow are specific to this samba share.

I wonder what are this for?

Got it!, thank you for clarifying.

These are for the files and folder that get created by your samba clients to be readable and writable for all on this machine. This is for the folder where any samba client can write files, not just read as in your downloads example, along with writable = yes.

And of course you can have one samba share read only, another writable by all the clients, third one accessible only by specific user (with username and password you’ve set up), and fourth readable by all but writable only by that one user – you can configure them in any way you want, all alike or all differently.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.