CentOS 7
Sponsored Link

Samba : Limited Accessed Shared Folder2014/07/16

 
Install Samba to configure File Server.
This example shows to create a shared Folder which requires user authentication.
[1] Configure Samba.
[root@smb ~]#
yum -y install samba samba-client
[root@smb ~]#
groupadd security

[root@smb ~]#
mkdir /home/security

[root@smb ~]#
chgrp security /home/security

[root@smb ~]#
chmod 770 /home/security

[root@smb ~]#
vi /etc/samba/smb.conf
# near line 66: add follows

unix charset = UTF-8
# line 89: change (Windows' default)

workgroup =
WORKGROUP
# line 95: uncomment and change IP address you allow

hosts allow = 127.
10.0.0.
# add follows to the end

[Security]    
# any name you like

    path = /home/security
    writable = yes
    create mode = 0770
    directory mode = 0770
    guest ok = no    
# guest not allowed

    valid users = @security    
# allow only security group
[root@smb ~]#
systemctl start smb nmb

[root@smb ~]#
systemctl enable smb nmb

# add a user in Samba

[root@smb ~]#
smbpasswd -a cent

New SMB password:    
# set password

Retype new SMB password:    
# confirm

Added user cent.
[root@smb ~]#
usermod -aG security cent

[2] If Firewalld is running, allow Samba service.
[root@smb ~]#
firewall-cmd --add-service=samba --permanent

success
[root@smb ~]#
firewall-cmd --reload

success
[3] If SELinux is enabled, change SELinux Context.
[root@smb ~]#
setsebool -P samba_enable_home_dirs on

[root@smb ~]#
restorecon -R /home/security

[4] It's the way to access to the shared folder. This example is on Windows 10.
Select [Computer] - [Map Network Drive].
[5] Specify the shared folder's place in Folder section and Click the 'Finish' button to enter.
[6] Authentication required. Input the username and password you added in Samba.
[7] Just accessed.
Matched Content