@
tees #28
之前测试过的配置,参考下。
# Anonymous and Selected Users
* Anonymous (nobody / guest) has the READONLY permission
* Authorized users (in sambausers group) have the READ/WRITE permission
## Add necessary group
```
# groupadd sambausers
```
Check
```
# cat /etc/group
```
## Add necessary users
Remove them first
```
# userdel -f sambauser1
# userdel -f sambauser2
```
Add
```
# useradd -m sambauser1 -G sambausers
# useradd -m sambauser2 -G sambausers
# echo 1234 | passwd --stdin sambauser1
# echo 1234 | passwd --stdin sambauser2
```
Check
```
# cat /etc/passwd
```
## Create directory in system
```
# mkdir -p /srv/ssharea
```
## Change directory's group
```
# chgrp sambausers /srv/ssharea
```
## Change directory's mode
(Users who in sambausers group can create file/directory in project)
(and these files/directories' owner are themself, group are sambausers)
(Give anonymous (nobody / guest) the ability to view its contents)
```
# chmod 2775 /srv/ssharea
```
## Add Samba users (and password)
```
# pdbedit -a -u sambauser1
```
(type password twice to create)
```
# pdbedit -a -u sambauser2
```
(type password twice to create)
## Edit /etc/samba/smb.conf
```
# vi /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
netbios name = LINUXSERVER
server string = This is a Linux Samba Server
passdb backend = tdbsam
unix charset = utf8
; display charset = utf8
dos charset = cp932
log file = /var/log/samba/log.%m
max log size = 50
security = user
guest account = nobody
map to guest = bad user
ntlm auth = yes
load printers = No
[ssharea]
comment = SSHAREA
path = /srv/ssharea
browseable = Yes
writable = No
write list = @
sambausers guest ok = Yes
```
## Start
```
systemctl start smb
systemctl start nmb
```