samba的簡單應用

2021-05-24 11:04:05 字數 3121 閱讀 7545

安裝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的簡單配置

global 別人會通過 網路上的芳鄰 看到workgroup組裡的 linux機器,注釋是 my samba server workgroup workgroup bios name linux server string my samba server 日誌設定 log file var log...

Samba 企業應用案例

1.所有員工都能夠在公司內流動辦公,但不管在哪電腦上工作,都要把自己檔案存在 samba 檔案服器上.2.各部門辦公人員擁有各自的主目錄,用於存放私有文件 工作相關 其他人禁止訪問.3.所有的使用者都不允許使用伺服器的 shell 安全考慮 4.製造部 財務部 管理部,都有各自的檔案目錄.5.各部門...

samba服務簡單配置

本人環境是centos6.5 一 安裝samba軟體包 yum install samba samba client samba swat 二 修改配置檔案 vim etc samba smb.conf security share 將安全級別修改為最低 share,user,server,doma...