Installing Samba Service on Rocky Linux 9.5

To install and configure the Samba server on Rocky Linux 9.5, follow the steps below. Samba is an open-source software that implements the SMB/CIFS protocol, allowing Linux systems to share files with Windows.

1. Install Samba

sudo dnf install samba samba-client samba-common -y

2. Create a Shared Directory

sudo mkdir -p /srv/samba/share
sudo chmod -R 0777 /srv/samba/share
sudo chown -R nobody:nobody /srv/samba/share

You can modify the permissions as needed; in a production environment, it is recommended to restrict permissions and use specific users.

3. Configure Samba

Edit the configuration file:

vi /etc/samba/smb.conf

Add the following at the end:

[Public]   path = /srv/samba/share   writable = yes   browsable = yes   guest ok = yes   guest only = yes   create mode = 0777   directory mode = 0777

4. Enable and Start the Samba Service

sudo systemctl enable --now smb nmb

5. Set Samba User (optional if guest is not enabled)

sudo useradd sambauser
sudo smbpasswd -a sambauser

Set the following permissions in the configuration file (replacing the above [Public]):

[Private]   path = /srv/samba/share   valid users = sambauser   guest ok = no   writable = yes   browsable = yes

6. Restart the SMB Service

systemctl restart smb nmb

In Windows File Explorer, enter: \\serverIP\Public

Leave a Comment