How to Install Samba Server in CentOS/RHEL 7/8 Password Less

Samba is an open-source and most popular widely used program that provides server and client software to allow sharing between Linux and Windows machines. Samba has proven its reliability and high performance in many organisations. Using Windows smbclient (GUI) or file explorer, end users can connect to the Samba server from any Windows server.

Useful Articles:

This tutorial will explain how to install and configure password less Samba on CentOS/RHEL.

Step 1: Install Samba Server

Samba is available in the standard CentOS repositories. you can install the samba package using the below command.

# dnf install samba samba-common samba-client

Step 2: Create Samba Share Directory and Set Permission

Once, the samba package is installed, you need to create a directory for samba share with proper permissions and ownership.

# mkdir -p /opt/techoism/data
# chmod -R 755 /opt/techoism/data
# chown -R  nobody:nobody /opt/techoism/data

Step 3: Configuring Firewall and SELinux

Now, Samba is installed and running on your server and Firewall and SELinux is enabled then you’ll need to configure your firewall and SELinux.

For Firewall:

# firewall-cmd --permanent --zone=public --add-service=samba
# firewall-cmd reload

For SELinux:

# chcon -t samba_share_t /opt/techoism/data

Step 4: Configuring Samba Shares

Now you need to make changes in the samba configuration file which is the main configuration file for Samba.

# vim /etc/samba/smb.conf

In the [global] section, add update the content as mentioned:

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos-8
security = user
map to guest = bad user
dns proxy = no
ntlm auth = true

After this change, we must append a new share at the end of the file.

[Public]
path =  /opt/techoism/data
browsable =yes
writable = yes
guest ok = yes
read only = no

Now, verify the samba configuration for errors.

# testparm

Step 5: Start Samba Service

Now, start and enable the samba services.

# systemctl start smb
# systemctl enable smb
# systemctl start nmb
# systemctl enable nmb
## OR ##
# service smb start
# chkconfig smb on
# service start nmb
# chkconfig nmb on

Step 6: Accessing Samba Share from Windows

Now, that you are ready to access the samba share, press the Windows logo key + R to launch the Run popup and enter the IP address.

Once you connect, you will be presented with the ‘Public’ directory.

We don’t have any files in the Samba share, let’s create new files with the following command.

# cd /opt/techoism/data/
# touch content{1..6}.txt

Once you have created files, refresh the samba share.

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.