1. installation
yum -y install samba samba-client
![]() |
if debian: apt -y install samba samba-client |
2. configuration
vi /etc/samba/smb.conf
#
# 14jan2016: initial version (ary)
[global]
workgroup = d01
server string = %h (samba server %v)
bind interfaces only = yes
interfaces = lo eth0
log level = 0
log file = /var/log/samba/log.%m
max log size = 50
printing = bsd
[d01]
comment = d01 share
path = /data1/d01/
read only = yes
browseable = yes
force user = root
force group = smbgroup
write list = @smbgroup
create mask = 0660
directory mask = 0770
force create mode = 0660
force directory mode = 0770
# vfs objects = audit
3. aftercare
groupadd smbgroup
useradd -G smbgroup smbusr
echo "smbusr:Passw0rd" | chpasswd
echo "Passw0rd" > /tmp/pwd
echo "Passw0rd" >> /tmp/pwd
smbpasswd -a "smbusr" -s < /tmp/pwd
rm -f /tmp/pwd
mkdir -p /data1/d01
4. service
systemctl enable smb.service
systemctl restart smb.service
5. testing
smbclient -L localhost -U smbusr%Passw0rd
Sharename Type Comment
--------- ---- -------
d01 Disk d01 share
IPC$ IPC IPC Service (srv214 (samba server 4.17.12-Debian))
SMB1 disabled -- no workgroup available
smbclient //localhost/d01 -U smbusr%Passw0rd -c 'mkdir demo'
ls -l /data1/d01/
total 4
drwxrwx--- 2 root smbgroup 4096 Jan 11 22:37 demo