Samba sharing on fedora 27

in #linux6 years ago

Samba sharing on fedora 27

I've noticed that the process for sharing a folder on Fedora has changed a bit
with the move to firewalld and SELinux and the Fedora documentation project was
a bit unclear about the specifics so I've prepared this small tutorial to help
anyone else that may have had an issue with this.

We're going to start with installing samba as it's not installed by default.

sudo dnf install samba

Then we're going to enable and start the smb and nmb services.

sudo systemctl enable smb nmb
sudo systemctl start smb nmb

Now you should create a password for your user in Samba.

sudo smbpasswd -a <username>

Before we write the configuration file, we need to create exceptions in SELinux and
firewalld. Let's start with SELinux.

The easiest way is to give samba read/write access everywhere on the filesystem.
Using this approach obviously has security repercussions, but should be a viable solution for most users.

setsebool -P samba_export_all_rw 1

Now for the firewalld exception.

sudo firewall-cmd --add-service=samba --permanent

Great! Now we just need to edit the samba configuration file. Use whatever text editor
you prefer. In this example I will use nano. But first I will create a backup.

sudo cp /etc/samba/smb.conf ~
sudo nano /etc/samba/smb.conf

Here is a short example configuration file assuming you have a folder in your
home folder called sharefolder.

[global]
        server string = serverName
        netbios name = serverName
        workgroup = SAMBA
        security = user

[sharefolder]
        path = /home/username/sharefolder
        read only = yes
        browseable = yes

Now all you have to do is restart smb and nmb

sudo systemctl restart smb nmb

And you're done.

Coin Marketplace

STEEM 0.27
TRX 0.12
JST 0.032
BTC 61769.55
ETH 2910.04
USDT 1.00
SBD 3.64