• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install and configure samba share on CentOS8.1

  • 00:48 yum install samba -y
  • 01:21 systemctl enable smb
  • 02:10 adduser --system system shareuser
  • 03:11 chown -R shareuser1 /value
  • 03:52 chcon -Rt samba_share_t
  • 09:11 smbpasswd -e shareuser1
{{postValue.id}}

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 snap1 Now open your share snap2 Clear the network cache before going to another user snap3 Change to different user snap4 With this, the method to install and configure Samba share on CentOS 8 comes to an end.

Tags:
sebastian
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Is there any other command? for adding users into a group but without deleting the old users in that group?

A

execute command "useradd -a -G group_name user_name".

Q

How to list samba users?

A

Use the command to list the samba users as "sudo pdbedit -L -v"

Q

What is the configuration file for samba?

A

it is /etc/samba/smb.conf.

Q

How will you verify that your smb.conf file doesn't have any mistakes and misspellings?

A

"testparm" tool that verifies the syntax of a configuration file(smb.conf).testparm s smb.conf

Q

How to start and stop the samba server?

A

/etc/init.d/smb restart
OR service smb restart

Load more

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.