Create Restricted Shared Folder2017/12/18 |
Install Samba to build a File Server.
For example, Create a shared Folder which requires user authentication.
|
|
[1] | Install and Configure Samba. |
[root@smb ~]#
[root@smb ~]# dnf -y install samba samba-client 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 # line 7: add unix charset = UTF-8
dos charset = CP932 # line 9: change ( Windows default ) workgroup = WORKGROUP
# line 11: IP addresses you allow to access hosts allow = 127. 10.0.0.
# add to the end # any share name you like [Security] path = /home/security writable = yes create mode = 0770 directory mode = 0770 # guest not allowed guest ok = no # allow only security group valid users = @security # add a user in Samba [root@smb ~]# useradd fedora [root@smb ~]# smbpasswd -a fedora New SMB password: # set password Retype new SMB password: Added user fedora. [root@smb ~]# usermod -G security fedora |
[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] - [network] - [Map Network Drive]. |
[5] | Specify the shared folder's place in Folder section and Click the [Finish] button to enter. |
[6] | Authentication is required, Input the username and password you added in Samba. |
[7] | Just accessed. |
Sponsored Link |