samba
【部署】
1、安装samba
```bash
apt install -y samba
```
2、配置文件
/etc/samba/smb.conf
```conf
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
deadtime = 15
disable netbios = yes
dns proxy = no
load printers = no
printable = no
max connections = 0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=524288 SO_SNDBUF=524288
allow insecure wide links = yes
unix extensions = no
follow symlinks = yes
wide links = yes
use sendfile = yes
read raw = yes
write raw = yes
large readwrite = yes
getwd cache = yes
strict sync = no
sync always = no
strict locking = no
fake oplocks = yes
oplocks = no
log level = 2
min protocol = NT1
max protocol = SMB2_10
usershare allow guests = yes
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[area_vm_data_1]
writeable=yes
browseable=no
vfs objects = btrfs
valid users = game_storage
path = /snapshot/out_link/area_vm_data/1
[area_vm_data_2]
writeable=yes
browseable=no
vfs objects = btrfs
valid users = game_storage
path = /snapshot/out_link/area_vm_data/2
[area_vm_data_3]
writeable=yes
browseable=no
vfs objects = btrfs
valid users = game_storage
path = /snapshot/out_link/area_vm_data/3
[area_vm_data_4]
writeable=yes
browseable=no
vfs objects = btrfs
valid users = game_storage
path = /snapshot/out_link/area_vm_data/4
[area_vm_image_1]
comment=area_vm_image_1
writeable=yes
browseable=no
vfs objects = btrfs
manipulate snapshots = no
valid users = game_storage
path = /data/out_link/area_vm_image/1
[area_vm_image_2]
comment=area_vm_image_2
writeable=yes
browseable=no
vfs objects = btrfs
manipulate snapshots = no
valid users = game_storage
path = /data/out_link/area_vm_image/2
[area_vm_image_3]
comment=area_vm_image_3
writeable=yes
browseable=no
vfs objects = btrfs
manipulate snapshots = no
valid users = game_storage
path = /data/out_link/area_vm_image/3
[area_vm_image_4]
comment=area_vm_image_4
writeable=yes
browseable=no
vfs objects = btrfs
manipulate snapshots = no
valid users = game_storage
path = /data/out_link/area_vm_image/4
```
3、添加系统用户game_storage至samba
```bash
smbpasswd -a game_storage
```
4、启动samba
```bash
systemctl restart smbd
```
【客户端验证】
客户端centos7
1、安装客户端工具
```bash
yum install -y cifs-utils
```
2、挂载
```bash
mount.cifs //cache.itvgame.org/area_vm_image_2 /mnt/ -o username=game_storage,password=game_storage,dir_mode=0777,file_mode=0777
```
/etc/fstab/
```conf
//cache.itvgame.org/area_vm_image_19 /mnt/vm_image/19 cifs username=game_storage,password=game_storage,dir_mode=0777,file_mode=0777
```