From: Tecmint
sudo apt install samba samba-common python-dnspython
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.orig
Khởi tạo thư mục lưu và phân quyền
sudo mkdir -p /srv/samba/anonymous_shares
sudo chmod -R 0775 /srv/samba/anonymous_shares
sudo chown -R nobody:nogroup /srv/samba/anonymous_shares
Thêm cấu hình trong file samba
sudo nano /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
netbios name = ubuntu
security = user
[Anonymous]
comment = Anonymous File Server Share
path = /srv/samba/anonymous_shares
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
Kiểm tra cài đặt trên
testparm
...
idmap config * : backend = tdb
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = No
[Anonymous]
comment = Anonymous File Server Share
path = /srv/samba/anonymous_shares
force user = nobody
read only = No
guest ok = Yes
Khởi động lại samba
sudo systemctl restart smbd
Trên máy Windows, truy cập bằng \IP-SAMBA

Khởi tạo group, user, pasword trong samba
sudo addgroup smbgrp
sudo usermod aaronkilik -aG smbgrp
sudo smbpasswd -a aaronkilik
Lưu ý:
User samba và user hệ thống là khác nhau, nếu muốn đồng bộ user từ hệ thống sang samba thì dùng libpam-winbind
Khởi tạo thư mục lưu và phân quyền
sudo mkdir -p /srv/samba/secure_shares
sudo chmod -R 0770 /srv/samba/secure_shares
sudo chown -R root:smbgrp /srv/samba/secure_shares
Thêm cấu hình trong file samba
sudo nano /etc/samba/smb.conf
[Secure]
comment = Secure File Server Share
path = /srv/samba/secure_shares
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
Kiểm tra cài đặt trên
testparm
...
[Anonymous]
comment = Anonymous File Server Share
path = /srv/samba/anonymous_shares
force user = nobody
read only = No
guest ok = Yes
[Secure]
comment = Secure File Server Share
path = /srv/samba/secure_shares
valid users = @smbgrp
read only = No
Khởi động lại samba
sudo systemctl restart smbd
Trên máy Windows, truy cập bằng \IP-SAMBA



