Ubuntu 18.04
Sponsored Link

Samba : Restricted share directory2018/06/06

 
Install Samba to share folders or files between Windows and Linux.
For example, Create a 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 users only in [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 -aG security ubuntu

root@smb:~#
systemctl restart smbd

[3] Configure on Windows client. This example is on Windows 10.
Select [This PC] - [Map Network Drive] like following example.
[4] Specify shared folder's place in Folder section like example and Click [Finish] button to enter.
[5] Authentication is required. Authenticate with a user added by smbpasswd command in section [1].
[6] Just accessed.
Matched Content