Step 1: Install Samba Server

# dnf install samba samba-common samba-client

Step 2: Create Samba Share Directory and Set Permission

# mkdir -p /opt/techoism/secure
# chmod -R 755 /opt/techoism/secure
# chown -R nobody:nobody /opt/techoism/secure
# chcon -t samba_share_t /opt/techoism/secure

Step 3: Configuring Firewall and SELinux

# firewall-cmd --permanent --zone=public --add-service=samba
# firewall-cmd reload
# chcon -t samba_share_t /opt/techoism/secure

Step 4: Configuring Samba Shares

# useradd smbuser
# groupadd smb_group
# usermod -g smb_group smbuser
# smbpasswd -a smbuser

Step 4: Configuring Samba Shares

# vim /etc/samba/smb.conf
[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
</pre>
[secure]
path = /opt/techoism/secure
valid users = @smb_group
guest ok = no
writable = no
browsable = yes
# testparm

Step 5: Start Samba Service

# 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

# cd /opt/techoism/secure
# touch secure{1..3}.txt
# dnf install samba-client 
# smbclient ‘\\10.0.0.4\secure’ -U smbuser
Logo

CentOS社区为您提供最前沿的新闻资讯和知识内容

更多推荐