Basic SAMBA Configuration

From Michael's Information Zone
Revision as of 15:17, 10 November 2019 by Michael.mast (talk | contribs) (Created page with "==CentOS 8== <ref>https://lintut.com/easy-samba-installation-on-rhel-centos-7/</ref> *Prepare the basic config by installing packages and creating a new config file. <pre> dnf...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CentOS 8

[1]

  • Prepare the basic config by installing packages and creating a new config file.
dnf install samba samba-client samba-common -y
mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp
  • Add the following to the file.
[global]
workgroup = WORKGROUP
server string = MAST_SHARE
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
  • If the users have not been created, create them now.
  • Add the users as samba users.
passwd user1
Changing password for user user1.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
  • In this example, I want to share a directory with several people. I create a group and add the users to it, then grant this group writes to the directory.
groupadd group1
usermod -a -G group1 user1
usermod -a -G group1 user2
chown -R user1:group1 /data/share1
chmod -R 0770 /data/share1
  • Update the samba config.
[share1]
path = /data/share1
valid users = @group1
guest ok = no
writable = yes
browsable = yes
  • Enable services
systemctl enable --now smb.service
systemctl enable --now nmb.service
  • Update firewall rules
firewall-cmd --permanent --add-service=samba
firewall-cmd --reload