todo

smb服务搭建

up:2021-02-19 10:41:10 edit:2022-02-18 10:49:49 view:660

yum install samba

官方文档

https://wiki.samba.org/index.php/Setting_up_a_Share_Using_POSIX_ACLs


config /etc/smb/smb.conf

man smb.cnf 看详细文档


#remove home section,if needed

groupadd grp

chmod 2770 dir #for subdir use parent group,consider set sticy bit too to avoid delete by other user



smb.cnf

force directory mode = 3000 #set sticy bit too to avoid delete by other user,and set use parrent dir group

directory mask = 3770 #avoid other user permission

force create mode = 0000 # this is default
create mask = 0640 #force default no permission, group only read




usermod -a -G grp user

adduser or useradd
passwd
smbpasswd
smbpasswd -a user 添加

smbcontrol smbd reload-config



addShareUser.sh

u=$1

if [ "x" = "x$u" ]
then
echo no user
exit
fi
echo username is $u
useradd $u
echo -e "$u\n$u" |passwd $u
usermod -a -G sharegrop $u

echo -e "$u\n$u" | smbpasswd -a $u


服务验证调试
smbclient -U USER%PASS -L SERVER_HOST #list service

use service smbclient -U USER -c ls \\\\SERVER_HOST\\SERVICENAME PASS




not in sinaapp