samba的简单应用

安装samba

#!/bin/bash
#SAMBA install script
#Create by wellpan
#20110109
password=88888888
yum install samba -y
#rpm -qa | grep samba
#samba-common-3.0.33-3.29.el5_5.1
#samba-client-3.0.33-3.29.el5_5.1
#samba-3.0.33-3.29.el5_5.1
groupadd marking
useradd -s/sbin/nologin -g marking tom
(echo $password ; echo $password) | smbpasswd -s -a tom; #设置密码
groupadd sales
useradd -s/sbin/nologin -g sales wellpan
(echo $password ; echo $password) | smbpasswd -s -a wellpan;
groupadd it
useradd -s/sbin/nologin -g it jake
(echo $password ; echo $password) | smbpasswd -s -a jake;
mkdir -p /home/shichangbu
chgrp -R marking /home/shichangbu
chmod 770 /home/shichangbu
mkdir -p /home/xiaoshoubu
chgrp -R sales /home/xiaoshoubu
chmod 770 /home/xiaoshoubu
mkdir -p /home/xinxijisbu
chgrp -R it /home/xinxijisbu
chmod 770 /home/xinxijisbu
#用户能访问目录的最终权限是被文件目录的权限和samba权限的最小权限交集所控制
cd /etc/samba
mv smb.conf smb.conf.bak
grep -v "#" smb.conf.bak > smb.conf
#显示去掉前面“#”说明,并显示文件的内容重定向导到当前目录的smb.conf文件中

smb.conf配置内容

#======================= Global Settings =====================================
[global]
workgroup = MDBQ
netbios name = MDBQ
server string = This is MDBQ samba server
#-----------------------languages Setting-----------------------------------
unix charset = utf8
display charset = utf8
dos charset = utf8

# --------------------------- Logging Options -----------------------------
log file = /var/log/samba/%m.log
max log size = 50

security = user
passdb backend = tdbsam

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no
template shell = /bin/false
winbind use default domain = no

#============================ Share Definitions ==============================
[shichangbu]
comment = shichangbu
path = /home/shichangbu
public = no #禁止匿名访问
browseable = yes
vaild users = @marking
write list = @marking
create mask = 0770
directory mask = 0770

[xiaoshoubu]
comment = xiaoshoubu
path = /home/xiaoshoubu
public = no
browseable = yes
vaild users = @sales
write list = @sales
create mask = 0770
directory mask = 0770

[ITbu]
comment = ITbu
path = /home/ITbu
public = no
browseable = yes
vaild users = @it
write list = @it
create mask = 0770
directory mask = 0770

[public]
comment = publice
path = /home/public
public = no
browseable = yes #表示不隐藏该目录
vaild users = @it @sales @marking
write list = @it
create mask = 0775
directory mask = 0775

测试配置文件testparm
使用smbstatus观察samba的状态

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值