游走的鱼

导航

samba部署

macos 原生对ftp支持不是那么友好,samba支持还可以,本文介绍samba安装,并带有文件删除自带保留策略。

 

[root@ftp-server samba]# ls
lmhosts smb.conf smb.conf.example smb.d
[root@ftp-server samba]# cat smb.conf
[global]
workgroup=BIGCLOUD
netbios name=ZZSRV2
security=user
map to guest = Bad User
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
log level = 0
vfs object = full_audit;recycle
full_audit:prefix = %S|%u|%I|%m
full_audit:success = chdir mkdir open opendir read rename rmdir write link unlink
full_audit:failure = none
full_audit:facility = local2
full_audit:priority = notice
recycle:repository = /data/recycle/ #删除的文件会自动保留在这个目录中
recycle:keeptree = yes
recycle:versions = yes
recycle:touch = yes
recycle:exclude = *.tmp,*.temp,*.log,*.swp,*.bak,*.~*,*.part,*.iso,*.vmdk,*.vmem
recycle:exclude_dir = /tmp,/temp,/cache,/lost+found,/Recycler,/recycler
passdb backend = tdbsam
load printers = no
cups options = raw




include = /etc/samba/smb.d/ui.conf

  

[root@ftp-server samba]# cd smb.d/
[root@ftp-server smb.d]# pwd
/etc/samba/smb.d
[root@ftp-server smb.d]# ls
ui.conf
[root@ftp-server smb.d]# cat ui.conf
[ui]
path = /data/ui/
public = no
writable = yes
write list = user1,user2,user3
read list = user1,user2,user3
valid users = user1,user2,user3
browseable = yes
create mask = 0664
directory mask = 0775
vfs object = full_audit;recycle

  两个配置文件就可以使用samba服务了。下面是samba用户添加脚本

[root@ftp-server ~]# groupadd smaba
[root@ftp-server ~]# cat smb_adduser.sh
#!/bin/bash

useradd -s /sbin/nologin -g samba $1
smbpasswd -a $1

  macos 打开访达,command+k ,输入smb://ip ,再输入用户密码即可。

posted on 2023-11-02 12:27  游走的鱼  阅读(33)  评论(0编辑  收藏  举报