CentOS7 Samba 相關設定

2021-09-27 05:49:29 字數 3011 閱讀 4369

[root@localhost]mkdir -p /abc/

[root@localhost abc]yum install samba -y

[root@localhost abc]groupadd ops

[root@localhost abc]groupadd sales

[root@localhost abc]groupadd share

[root@localhost abc]useradd -s /sbin/nologin ops

[root@localhost abc]useradd -s /sbin/nologin sales

[root@localhost abc]useradd -s /sbin/nologin share

[root@localhost abc]#smbpasswd -a ops

123456

123456

[root@localhost abc]#smbpasswd -a sales

123456

123456

[root@localhost abc]#smbpasswd -a share

123456

123456

[root@localhost abc]# chown ops:ops ops

[root@localhost abc]# chmod 770 ops

[root@localhost abc]# chown sales:sales sales

[root@localhost abc]# chmod 770 sales

[root@localhost abc]# chown share:share share

[root@localhost abc]# chmod 777 share

[root@localhost abc]# systemctl restart smb

[root@localhost abc]# cat /etc/samba/smb.conf

[global]

workgroup = samba

security = user

passdb backend = tdbsam

printing = cups

printcap name = cups

load printers = yes

cups options = raw

[homes]

comment = home directories

valid users = %s, %d%w%s

browseable = no

read only = no

inherit acls = yes

[printers]

comment = all printers

path = /var/tmp

printable = yes

create mask = 0600

browseable = no

[print$]

comment = printer drivers

path = /var/lib/samba/drivers

write list = @printadmin root

force group = @printadmin

create mask = 0664

directory mask = 0775

#[common]

#[smbtest]

[ops]

comment = ops share

path = /abc/ops

browseable = yes

valid user = ops

writable = yes

guest ok = no

write list = ops

[sales]

comment = sales share

path = /abc/sales

browseable = yes

valid user = sales

writable = yes

guest ok = no

write list = sales

[share]

comment = share

path = /abc/share

browseable = yes

valid user = share

writable = yes

guest ok = yes

write list = share

[root@localhost abc]# ll

總用量 4

drwxrwx---+ 3 ops ops 140 9月 3 10:37 ops

drwxrwx--- 4 sales sales 4096 8月 30 15:57 sales

drwxrwxr-x 5 share share 160 8月 26 16:32 share

[root@localhost abc]# getfacl ops

user::rwx

group::rwx

mask::rwx

other::---

setfacl的作用和用法:

描述:設定文件訪問控制列表

選項:-b #刪除所有附加的acl條目

-k #刪除預設的acl

-m #新增acl條目

-x #刪除指定的acl條目

-r #遞迴處理所有的子檔案與子目錄

[root@localhost abc]#setfacl -m u:sales:rw ops

[root@localhost abc]#getfacl ops

user::rwx

user:sales:rw-

group::rwx

mask::rwx

other::---

[root@localhost abc]#setfacl -x u:sales ops

CentOS 7 samba 的簡易配置

一 安裝 預設很可能已經安裝了,如果沒有,則 yum install samba 若系統為ubuntu或其他,則需要修改配置檔案以允許訪問家目錄 etc samba smb.conf 中的 homes 段 二 設定賬戶和許可權 smbpasswd a cj 本文件只設定訪問家目錄許可權,所以建立乙個...

centos7 samba安裝和配置

yum install samba y 配置檔案 etc samba smb.conf root dockerhome cat etc samba smb.conf see smb.conf.example for a more detailed config file or read the sm...

centos7 設定samba服務

samba主要是用於在windos對映到linux。開發中這樣做非常方便。安裝 yum y install samba 備份配置檔案 cp etc samba smb.conf etc samba smb.conf bk 修改配置 vi etc samba smb.conf global workg...