samba服务器搭建
安装
~]
samba服务器访问过慢的问题
具体表现:
samba服务正常启动,win下可以访问,打开时要等待很久
解决办法:
1、查看/etc/sysconfig/network中hostname
2、编辑/etc/hosts文件,添加hostname的值到127.0.0.1
3、重启服务或服务器
配置
samba配置
~]
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = yes
hosts allow = 10.207.
cups options = raw
[公共]
comment = This is a public directory
path = /data/public
public = yes
writable = yes
create mask = 0755
directory mask = 0755
[张三]
path = /data/zhangsan
valid users = @zhangsan
read list = @zhangsan
write list = @zhangsan
[李四]
path = /data/lisi
valid users = @lisi
read list = @lisi
write list = @lisi
[收入组]
path = /data/shouruzu
valid users = @shouruzu
group = shouruzu
read list = @shouruzu2
write list = @shouruzu1
create mode = 0664
directory mode = 0775
[预算组]
path = /data/yusuanzu
valid users = @yusuanzu
group = shouruzu
write list = @yusuanzu
create mode = 0664
directory mode = 0775
[网银组]
path = /data/wangyin
valid users = @wangyin
group = wangyin
read list = @wangyinread
write list = @wangyinwrite
create mode = 0664
directory mode = 0775
[总账-费用]
path = /data/zongzhang-feiyong
valid users = @feiyongzu
group = feiyongzu
read list = @feiyongzu
write list = @feiyongzu
create mode = 0664
derectory mode = 0775
组配置
zhangsan:x:517:
lisi:x:518:
shouruzu:!:521:shaojin,songwei,lijuan,ailing
yusuanzu:x:522:gaohe,jiangquan,zhangyan,yangjing
feiyongzu:x:527:ailing,dongqi,duhua
wangyin:x:528:zhaowei,duhua,shaojin,luya,hansong
shouruzu1:x:529:songwei,shaojin
shouruzu2:x:530:luxin,zanpeng
wangyinread:x:531:zhaowei,duhua,shaojin,hansong
wangyinwrite:x:532:luya
......
samba服务器磁盘检测脚本
#!/bin/bash
function fun_chksize()
{
if [ $2 -ge $3 ];then
switch_file_size=$(($2/1024))
echo -n -e "samba服务器 ${1} 空间已使用${switch_file_size}M\n" | mail -s "samba服务器空间使用告警" $4
fi
}
smb_dir=/data
ip=`ifconfig | grep Bcast | awk '{print $2}' | awk -F: '{print $2}'`
admin_mail_addr="yongtao2@leju.com"
total_max_size=15360000000
total_use_size=`du -s $smb_dir | awk '{print $1}'`
max_size=10240
public_max_size=10240
fun_chksize $smb_dir $total_use_size $total_max_size $admin_mail_addr
for list1 in ${smb_dir}/*; do
file_list=`basename $list1`
cd $smb_dir
file_size=`du -s $file_list | awk '{print $1}'`
switch_file_size=$(($file_size/1024))
file_name=`du -s $file_list | awk '{print $2}'`
case $file_name in
public)
fun_chksize $file_name $file_size $public_max_size $admin_mail_addr
;;
ailing)
fun_chksize $file_name $file_size $max_size $admin_mail_addr
;;
*)
fun_chksize $file_name $file_size $max_size $admin_mail_addr
;;
esac
done