参考pdf文档:https://pan.baidu.com/s/1iPJ1iPtNx7ZXNHRurrjfqw
centos7 samba配置
#centos7安装Samba
yum -y install samba samba-client samba-common
#备份配置文件
cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
#检查配置
testparm
#添加系统账号
useradd zhanglin
#添加samba账号
pdbedit -a -u zhanglin
baodian_develop
#修改samba账号密码
smbpasswd -a zhanglin
baodian_develop
#显示samba账号
pdbedit -L
#删除samba账号
pdbedit -x -u zhanglin
#设置开机启动
systemctl enable smb.service
systemctl enable nmb.service
#重启smb服务
systemctl restart smb.service
systemctl restart nmb.service
添加samba用户脚本
read -p "please input adduser name:" name
useradd $name
echo baodian_develop | passwd $name --stdin
/usr/bin/expect -c "
spawn /bin/pdbedit -a -u $name
expect {
\"new password:\" {send \"baodian_develop\r\";exp_continue}
\"retype new password:\" {send \"baodian_develop\r\"} }
exit "