Configure Samba for file sharing between Linux and Windows on Fedora
Configuring Samba for File Sharing Between Linux and Windows on Fedora turns a Fedora workstation or server into an SMB file server. Windows users can then browse shared directories through File Explorer and map them as network drives, while Linux administrators retain control over authentication, storage, and permissions.
A Samba server is useful for Australian offices running mixed Linux and Windows environments, including small businesses that cannot justify replacing established Windows equipment. Samba supports modern SMB2 and SMB3 connections, Linux user accounts, SELinux labels, and integration with firewalld.
This walkthrough creates a restricted share named shared, limits access to members of an smbusers group, and uses a Samba password rather than the user’s Linux login password. A stable DNS name and a tested Windows client are assumed.
| Consideration | Fedora Samba server | Windows client |
|---|---|---|
| File access | SMB/CIFS network share | Explorer or mapped drive |
| Authentication | Samba account and password | Windows credential prompt |
| Addressing | DNS name and share name | \\server\share |
| Permissions | Linux, group, and Samba rules | User access through the share |
Plan the share and network boundary
Choose a stable DNS name such as fedora.example.com before configuring clients. Avoid relying on changing IP addresses, and ensure both systems can resolve the server name. The share name shared will appear after the server name in Windows Explorer.
Treat SMB as a privileged network service. Restrict access to trusted office or VPN networks, require named accounts, and do not expose TCP port 445 directly to the internet. Teams that need repeatable client checks can borrow the reporting approach used by automated acceptance tests to record whether each Windows client can list and write to the intended share.
Install Samba and prepare storage
Install the Samba server, client utilities, and SELinux management tools on Fedora:
sudo dnf install samba samba-client samba-common-tools policycoreutils-python-utils
sudo systemctl enable --now smb
Create the shared directory and a dedicated group. The directory belongs to the group but is not writable by every local account:
getent group smbusers || sudo groupadd smbusers
sudo install -d -o root -g smbusers -m 0770 /srv/samba/shared
Because /srv/samba/shared is not a default Samba location, assign it the correct SELinux type. Without this label, smbd may deny access even when the Linux permissions appear correct:
sudo semanage fcontext -a -t samba_share_t '/srv/samba/shared(/.*)?'
sudo restorecon -Rv /srv/samba/shared
Define users, permissions, and Samba settings
Create or adapt a local account, add it to smbusers, and register its Samba password. The -M option avoids creating a home directory, while the shell prevents an interactive Linux login:
id alice >/dev/null 2>&1 || sudo useradd -M -s /usr/sbin/nologin -G smbusers alice
sudo smbpasswd -a alice
Define the share in /etc/samba/smb.conf:
[shared]
path = /srv/samba/shared
browseable = yes
read only = no
guest ok = no
valid users = @smbusers
force group = smbusers
create mask = 0660
directory mask = 0770
Validate the configuration before reloading the service:
sudo testparm -s
sudo systemctl reload smb
Recent Samba releases disable SMB1 by default. For sensitive material, test server smb encrypt = required in the global section after confirming that every client supports encrypted SMB3. Also remove accounts from smbusers and smbpasswd when someone leaves the organisation.
Connect from Windows and verify access
On a Windows 11 computer, open File Explorer and enter \\fedora.example.com\shared. Select Map network drive, choose a drive letter, and connect. When Windows requests credentials, supply the Samba username and its smbpasswd password rather than expecting the Windows domain account to work automatically.
Test access independently from Fedora:
smbclient -L //fedora.example.com -U alice
smbclient //fedora.example.com/shared -U alice
If the connection fails, check DNS resolution, smbstatus, and the Samba journal. On a firewalld-enabled host, allow the predefined Samba service and reload the firewall:
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload
sudo journalctl -u smb -b --no-pager
A web application failure on the same host may be unrelated to file sharing. If Fedora also fronts an application through Nginx, use a guide to troubleshoot Nginx 502 errors to separate proxy problems from SMB authentication or permission failures.
Maintain access and meet Australian obligations
Monitor Samba logs, disk capacity, account membership, and configuration changes. Keep the operating system and Samba packages updated, and back up shared data independently of Samba. A Samba share provides access to files, but it does not replace scheduled backups, retention policies, or tested recovery procedures.
Across the Australian small-business market, extending existing Windows fleets is often more practical than replacing every endpoint. Offices in Sydney, Melbourne, and Brisbane may therefore support several Windows versions, hybrid staff, and managed-service providers simultaneously. Remote employees should use a trusted VPN instead of public SMB exposure. If a share contains personal information, assess the Australian Privacy Principles and the Notifiable Data Breaches scheme under the Privacy Act 1988.
The practical takeaway is to begin with one named group, one non-guest share, a stable DNS name, and a tested SMB3 connection from a Windows laptop; expand only after SELinux, firewall rules, logging, and backups have been verified.