How to Install and configure samba share on CentOS8.1
How to Install and configure samba share on CentOS8.1
Introduction:
Samba is a tool which helps its users to share files and printer to SMB/CIFS clients from a Linux server/desktop, which you can even connect to a Windows Domain. This tutorial will show you the method on how to install samba on CentOS8
Installation process:
First install Samba4 and required packages from the default CentOS repositories using the yum package manager tool.
linuxhelp user #yum install samba -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libsmbclient libwbclient0 python-dnspython python-ldb python-samba python-tdb samba-common
…….
Setting up samba-common-bin (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
You should now check the status of Samba service by running the following command.
linuxhelp user # systemctl status smbd
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd bad vendor preset: enabled)
Active: active (running) since Wed 2018-03-07 16:38:06 IST 27s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/smbd.service
├─15577 /usr/sbin/smbd -D
├─15580 /usr/sbin/smbd -D
└─15583 /usr/sbin/smbd -D
Mar 07 16:38:05 linuxhelp systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Mar 07 16:38:06 linuxhelp smbd[15561]: * Starting SMB/CIFS daemon smbd
Mar 07 16:38:06 linuxhelp smbd[15561]: ...done.
Mar 07 16:38:06 linuxhelp systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
Once its done, you need to run these commands to create a Directory.
Create two directries for share
linuxhelp user # mkdir /data
linuxhelp user # mkdir /value
In order to change ownership of file and directories to run the below commands.
linuxhelp user # chown -R shareuser /data
linuxhelp user # chown -R shareuser1 /value
And you need to create new user as follows.
linuxhelp user # adduser –system shareuser
linuxhelp user # adduser –system shareuser1
And add those users to Samba service
linuxhelp user # smbpasswd -a shareuser
New SMB password:
Retype new SMB password:
Added user user1.
Create password for another user
linuxhelp user # smbpasswd -a shareuser1
New SMB password:
Retype new SMB password:
Added user user2.
Now, open Samba configuration file.
linuxhelp user # vim /etc/samba/smb.conf
And add the following line in the end of the file
[share1]
path = /data
valid users = shareuser
read list = shareuser
write list = shareuser
browsable = yes
invalid users = shareuser1
[share2]
path = /value
valid users = shareuser1
read list = shareuser1
write list = shareuser1
browsable = yes
invalid users = shareuser
Now restart samba service linuxhelp user # systemctl restart smbd
Also, make sure you check the IP address.
linuxhelp user # ip a s
1: lo: < LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: < BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 00:0c:29:2c:09:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.235/24 brd 192.168.7.255 scope global ens33
valid_lft forever preferred_lft forever
Now move to the client pc.
Open windows explorer and give you samba share link
Now open your share
Clear the network cache before going to another user
Change to different user
With this, the method to install and configure Samba share on CentOS 8 comes to an end.
Comments ( 0 )
No comments available