Connect with us

Hi, what are you looking for?

Linux

How To Configure Samba Server in Multi User Mode on CentOS 8 / RHEL 8

In this guide we will configuring Samba Server in Multi User Mode on CentOS 8 / RHEL 8. Samba server is most widely used for files sharing between Linux and Windows. If there is more than one user then want to share the files or directory this guide is intended for that to understand what is multi user mode you need to follow this guide completely.

Step-1 : Create the user to access the samba share

Note: Before starting this guide you need to follow the all the 13 steps from this Guide: How to Configure Samba Server in Single User Mode on CentOS 8 / RHEL 8.

First of all we creating two users.

[root@techbrown~]# useradd tech

Add another one

[root@techbrown~]# useradd brown

Step-2 : Set the samba password to the user

Samba password file smbpasswd is encrypted  format password file. this file contains user ids, and passwords and all account information.

Advertisement. Scroll to continue reading.
[root@techbrown~]# smbpasswd -a tech

It will show given output:

New SMB password :techbrown

Press ENTER then it will show given output:

Retype new SMB password: techbrown

Press ENTER then it will show given output:

Added user tech.

Give samba password to the brown user also

Advertisement. Scroll to continue reading.
[root@techbrown~]# smbpasswd -a brown

It will show given output:

New SMB password : penguin

Press ENTER then it will show given output:

Retype new SMB password: penguin

Press ENTER then it will show given output:

Added user brown.

Step-3 : Set the access permission to both users

In this tutorial user tech is having only read permission & user brown is having read as well as write permission.

Advertisement. Scroll to continue reading.
[root@techbrown~]# setfacl -m u:tech:r-x /linux

[root@techbrown~]# setfacl -m u:brown:rwx /linux

setfacl command is the utility set access control list for the files and directories.

Step-4 : Configure share directory in the configuration file

The configuration file for samba is smb.conf. this file available in /etc/samba/smb.conf.

In this file user have to specify the work-group and add the information related to the SHARE, add share name and allowing users.  have to add the hosts which allows to access the share.

In this tutorial Work-group is tech, user is tech & brown, share name is techsamba, share directory /linux

Advertisement. Scroll to continue reading.
[root@techbrown~]# vim /etc/samba/smb.conf

It will show given output:

Line No 89 : workgroup = tech
end of the Document:
[techsamba]
path=/linux
valid users=tech, brown
read list=tech, brown
write list = brown
browseable=yes
hosts allow=127. 172.25.2.
:wq

Step-5 : Check whether the SAMBA Configuration file Systematically correct or not

[root@techbrown~]# testparm

After this command is used it will show the configuration which  user configured

Step-6 : Restart the Services for set up all configuration which user made

[root@techbrown~]# systemctl restart smb nmb

Step-7 : Now, Check whether the share is accessible or not for both the user and hosts which mentioned in configuration file

[root@techbrown~]# smbclient //172.25.2.50/techsamba -U tech
Enter tech's password:

Enter the samba password which is given to user pro. and check user pro is able to access to share.

Domain=[tech] OS=[Unix] Server=[Samba 4.1.1]
smb: \> ls
. D 0 Wed Mar 24 10:12:30 2020
.. D 0 Wed Mar 24 10:12:30 2020
40913 blocks of size 262144. 27465 blocks available

The tech share is successful shared and user pro is able to access the share in the server side.

Advertisement. Scroll to continue reading.

Now server can be mounted by client side thus user can access the share by client side

Step-8 : Install the package using DNF package manager

On the Client side 2 packages are needed

  1. CIFS  –  It is open standard version of Server Message Block called Common Internet File System. CIFS Allows the sharing such as files,printers, etc between windows and Linux operating systems.
  2. SAMBA-Client –  It is open standard version of Samba Client.
[root@techbrown~]# dnf install cifs-utils samba-client -y

Step-9 : Create a directory where the share should be mounted

[root@techbrown~]# mkdir /mnt/linux

Step-10 : Create a mount point for the share in Client side using System Configuration file

For mounting the share /etc/fstab is the system configuration file.

[root@techbrown~]# vim /etc/fstab

Sample Output:

//172.25.2.50/linux /mnt/linux cifs
defaults,multiuser,sec=ntlmssp,username=brown,password=penguin 0 0
:wq

Sec=ntlmssp : stands for NT LAN Manager Security Supports Provider.

Advertisement. Scroll to continue reading.

Step-11 : Confirm the mount

[root@techbrown~]# mount -a

Step-12 : Check whether the share is successfully mount or not

[root@techbrown~]# df -hT

It will show given output

Filesystem                             Size      Used Avail    Use% Mounted on
/dev/vda1                              10G      3.1G  6.9G     31% /
devtmpfs                                906M  0        906M  0% /dev
tmpfs                                      921M   80K   921M   1% /dev/shm
tmpfs                                      921M   17M   904M   2% /run
tmpfs                                      921M   0        921M    0% /sys/fs/cgroup
//172.25.2.50/linux         10G      3.3G  6.8G    33% /mnt/linux

Step-13 : Create the users which created in server side

[root@techbrown~]# useradd tech

[root@techbrown~]# useradd brown

Step-14 : Login with the first user

[root@techbrown~]# su – tech

Step-15 : Add the cifs Credential

[root@techbrown~]# cifscreds add 172.25.2.50

[root@techbrown~]# cd /mnt/smbspace/

[root@techbrown smbspace]# touch test.txt

Read only file system touch cannot allow

[root@techbrown ~]# su - brown

[root@techbrown ~]# cifscreds add 172.25.2.10

[root@techbrown ~]# cd /mnt/smbspace/

[root@techbrown ]# touch test.txt

[root@techbrown ]# ls

Conclusion : Now you have successfully installed and configured the Samba in Multi User Mode on CentOS 8 / RHEL 8. You are ready to access the samba share on Linux as well as on Windows machine in Multi User Mode. If you have any issues related to this tutorial feel free to use the comment section below.

Advertisement. Scroll to continue reading.
Comments
Advertisement
Advertisement
Advertisement

You May Also Like

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Windows

Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...

Windows

How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...

Windows

How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...