Ubuntu 17.04
Sponsored Link

Restricted share directory
2017/04/23
 
Install Samba to share folders or files between Windows and Linux.
For example on here, Create a restricted share directory that requires user authentication.
[1] Install Samba.
root@smb:~#
apt -y install samba

[2] Configure Samba.
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
# line 25: add

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

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

interfaces = 127.0.0.0/8
10.0.0.0/24
# line 58: uncomment

bind interfaces only = yes
# 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 user in Samba

root@smb:~#
smbpasswd -a ubuntu

New SMB password:    
# set password

Retype new SMB password:
Added user ubuntu.
root@smb:~#
usermod -G security ubuntu

root@smb:~#
systemctl restart smbd

[3] Configure on Windows client. This example is on Windows 10.
Open [File Explorer] and Right-Click [Network] on the left Pane and Select [Map Network Drive].
[4] Input [\\(server)\(shared directory)']
[5] Authentication is required. Input the Samba username and password added in [1].
[6] Just accessed.
Matched Content