Edited 1 week ago by ExtremeHow Editorial Team
FedoraSambaFile SharingConfigurationNetworkingWindows IntegrationSecure SharesSoftwareSystem AdministrationComputers
This content is available in 7 different language
Samba is a free software re-implementation of the SMB/CIFS networking protocol, and it was originally developed by Andrew Tridgell. With Samba, you can seamlessly share files and printers between different operating systems. It is most commonly used to allow access to file systems from a Windows environment, but it can be used for various other purposes as well. In this guide, we will explore how you can configure a Samba share on a Fedora system.
Samba is an open-source software suite that provides seamless file and print services to SMB/CIFS clients. It allows interoperation between Linux/Unix servers and Windows-based clients. Essentially, Samba lets a Linux server host file-sharing capabilities that Windows clients can access, acting as if they were connecting to a Windows server.
Before we start configuring Samba, you need to have the following things:
First, you need to make sure that you have Samba installed on your Fedora system. You can do this using dnf
package manager.
sudo dnf install samba samba-client
This command will install both the Samba server and client packages on your system.
To verify that Samba has been successfully installed, you can check the version of Samba using the following command:
smbd --version
If Samba is installed correctly, this command will display the version number.
The main configuration file for Samba is located at /etc/samba/smb.conf
. This file controls all configuration related to your Samba server.
You can open this file using a text editor like nano
or vi
with root privileges:
sudo nano /etc/samba/smb.conf
The smb.conf
file is divided into sections. The [global] section contains settings that affect the overall behavior of your Samba server. Here is an example of some basic global configuration:
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = fedora
security = user
map to guest = bad user
dns proxy = no
Once you have set up the global configuration, the next step is to define the actual share. A share is a directory on your server that you want to share over the network.
For the sake of demonstration, let's assume you have a directory /srv/samba/share
that you want to share. You need to add a new section at the end of your smb.conf
file, like this:
[Share]
path = /srv/samba/share
browseable = yes
writable = yes
guest ok = yes
read only = no
It is important that the correct permissions are set on your directories so that Samba can access them properly. You must ensure that the directory is owned by the user and group from which you want Samba to serve it. This can be done with chown
command:
sudo chown -R nobody:nobody /srv/samba/share
And set the permissions to allow read/write:
sudo chmod -R 0775 /srv/samba/share
Now that you have configured Samba, you need to start it and enable it to start on boot:
sudo systemctl start smb
sudo systemctl start nmb
Enable services to start on boot:
sudo systemctl enable smb
sudo systemctl enable nmb
If you have a firewall running, you must configure it to allow Samba traffic. Assuming you are using firewalld
, you can allow Samba traffic with the following command:
sudo firewall-cmd --permanent --zone=public --add-service=samba
sudo firewall-cmd --reload
This allows Samba to pass through your firewall's default zone, ensuring it can communicate on the network.
From a Windows machine, you can access the Samba share by opening File Explorer and typing \\\Share
in the address bar.
On a Linux machine, you can mount the share using cifs-utils
package. First, install the package if you haven't already:
sudo dnf install cifs-utils
Create the directory where you want to mount the share:
mkdir ~/sambashare
Now mount the share:
sudo mount -t cifs -o username=guest,password=guest ///Share ~/sambashare
By following these steps, you have set up Samba shares on your Fedora system. This concludes the guide on configuring Samba, which allows you to seamlessly share files across different systems. With Samba, interoperation between Linux and Windows is simplified, making it easier to share resources across diverse computing environments.
If you find anything wrong with the article content, you can