Install and set up SAMBA File Share on Fedora

Install and set up SAMBA. Samba is the standard Windows interoperability suite of programs for Linux and Unix. SAMBA allows you to share folders between Linux, Windows and MAC. This tutorial will show you how to install and set up Samba share.


The first thing we need to do is disable SeLinux. In order to do this you must have root privileges type su and switch to root user.

[jhealy@Jadelinux ~]$ su
Password:
[root@Jadelinux jhealy]#

Once you have switched to the root user type

[root@Jadelinux jhealy]# nano /etc/selinux/config
Find the line SELINUX=enforcing and change it from SELINUX=enforcing to SELINUX=disabled
Push ctrl + x then hit Enter to save then reboot the computer.

#
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
#

After the reboot launch the terminal again and switch to the root user.

[jhealy@Jadelinux ~]$ su
Password:
[root@Jadelinux jhealy]#

Then type

[root@Jadelinux jhealy]# dnf install samba

Hit Enter

Package Arch Version

Installing x86_64 2:4.1.3-2fc20
samba

Transaction Summary

Install 1 Package

Total download size: 534 k
Installed size: 1.6 M
Is this ok [y/d/N]

Hit y then enter to continue

Installed:
samba.x86_64 2:4.1.3-2fc20
Complete!

Now we need to back up the original smb.conf file. It's good practice to back up important config files and in case of anything going wrong we will have the original to fall back on.

Type

[root@Jadelinux jhealy]# cp -p /etc/samba/smb.conf /etc/samba/smb.conf.bak

Now to confirm that the file has backed up successfully type

[root@Jadelinux jhealy]# ls /etc/samba/

Then you should see

[root@Jadelinux jhealy]# ls /etc/samba/
lmhosts smb.conf smb.conf.bak
[root@Jadelinux jhealy]#

Now we need to create a share folder. It's this folder the will be accessible over the network. Change directory with the cd .. command.

[root@Jadelinux jhealy]# cd ..

As you can see the prompt has changed from

[root@Jadelinux jhealy]# to [root@Jadelinux home]#

Now type ls

[root@Jadelinux home]# ls
jhealy

Now we create our shared folder. Type the command mkdir share

[root@Jadelinux home]# mkdir share

Type ls again and you should see

[root@Jadelinux home]# ls
jhealy   share

Now we need to change the permissions of the folder this can be done by typing chmod 0777 share

[root@Jadelinux home]# chmod 0777 share

OK now we need to configure SAMBA and allow it to access the share folder we just created and also give our user the rights to assess the share. So we need to change directory. cd /etc/samba

[root@Jadelinux home]# cd /etc/samba/

As you can see the prompt has changed again from

[root@Jadelinux home]# to [root@Jadelinux samba]#

Type nano smb.conf

[root@Jadelinux samba]# nano smb.conf

You will need to delete all the text inside the smb.conf and replace it with the text below. You can copy and paste the code and edit it to your needs.

The line with valid users = jhealy needs to be changed to your username Example valid users = johndoe

[global]

workgroup = WORKGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw


[LinuxShare]
path = /home/share
valid users = jhealy
browsable = yes
writable = yes
guest ok = no
read only = no

You can download a pre-built config file Here

Push ctrl + x then hit Enter to save

Because Samba has its own password database, you have to set a password for your user. Type the command smbpasswd -a jhealy

[root@Jadelinux samba]# smbpasswd -a jhealy

You are then prompted to type a new password for your samba access. Type your password hit enter then retype your password. You should see something like

New SMB password:
Retype New SMB password:
Added user jhealy.

Now we need to start the samba service for Fedora we run the command "systemctl start smb.service" and "systemctl start nmb.service"

[root@Jadelinux samba]# systemctl start smb.service
[root@Jadelinux samba]# systemctl start nmb.service

Also to make sure the service starts after reboot for Fedora run these commands "systemctl enable smb.service" and "systemctl enable nmb.service"

[root@Jadelinux samba]# systemctl enable smb.service
[root@Jadelinux samba]# systemctl enable nmb.service

There is one more thing we need to do and that's to configure the firewall to allow the samba to pass through.

Launch Firewall and enter your root password. At the top left hand corner there is a dropdown menu "Configuration" and Permanent needs to be selected

Under Zone select public and under services on the right hand side select samba and samba-client

1

Now under zone again select trusted and on the right hand side under service select samba and samba-client

2

Now exit firewall and reboot your computer.

3

After you have rebooted the computer click on files browser. On the left hand side under network click on Browse Network this will show you a list of computers sharing folders on the network. You should see your computer name listed here. Double click on it.

You are prompted to enter a username and password these are the details you entered during the samba setup.

4

That is it you have successfully installed and configured SAMBA file share. I hope this has helped you.