The Samba is a computer program used in operating Unix-like systems, simulates a Windows server, allowing it to be done management and file sharing on a Microsoft network. This guidance will show how to add and configure the Samba service at a CentOS 7.
1 - To install samba packages go to terminal and as root enter type:
#yum install samba samba-client samba-common -y
2 - Configure samba and edit the file /etc/samba/smb.conf. Before edit it, we will make a copy of /etc/samba/smb.conf file
#cp -p /etc/samba/smb.conf /etc/samba/smb.conf.bkp
#vi /etc/samba/smb.conf
Edit the smb.conf file and paste it:
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#=================Share Definitions ===================
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
3 - Create a folder to be shared with everyone without security, anonymous:
#mkdir -p /samba/anonymous
4 - Restart the samba services:
#systemctl enable smb.service
#systemctl enable nmb.service
#systemctl restart smb.service
5 - Change the permission for samba share:
#chmod -R 0755 anonymous/
6 - Finally, we will test the access of this new share from Windows system. Go to start>run and type \\[hostname or IP]\share and check out:
For create a Secure folder at samba service, follows:
#useradd joe
#groupadd smbgrp
#usermod -a -G smbgrp joe
#smbpasswd -a joe
#smbpasswd -a joe
New SMB password: XXXXXX
Retype new SMB password: XXXXXX
Added user joe.
#mkdir -p /samba/security
chown -R joe:smbgrp /samba/security/
chmod -R 750 /samba/security/
chcon -t samba_share_t /samba/security/
Edit the smb.conf file as below:
#vi /etc/samba/smb.conf
Add the security shared folder
[Security]
path = /samba/security
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
Now, from Windows side check out the folder and access with id create previously:
Nenhum comentário:
Postar um comentário