samba的简单应用
2011-03-04 13:34
190 查看
安装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的状态
#!/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的状态
相关文章推荐
- Samba 服务器的简单配置与应用
- samba在企业中的简单应用!
- Samba简单应用案例
- Samba的简单应用
- SAMBA简单应用
- SAMBA简单应用
- 企业中Samba简单应用
- NFS和SAMBA的简单应用(一)
- samba 简单应用教程 只上传 只写不删除
- HDU3625-----第二类strling number的简单应用
- 第八章:简单应用举例(1)
- 关于数据库中FK的简单理解以及应用
- 简述LDA,PCA,SVD原理推导及其简单应用
- LQR 的直观推导及简单应用
- struts2的简单应用配置
- JavaScript实际应用:简单二级联动菜单实现
- javaFx菜单简单应用示例--1多级菜单
- ionic 简单应用下拉刷新 选项卡栏操作 滚动条
- (精)位运算符的一些简单应用
- WebClient的一些简单应用