1. 程式人生 > >[svc]samba服務搭建

[svc]samba服務搭建

samba服務搭建 mba use 讀寫 logs people min 設置密碼 fast

說實話搞這些很蛋疼, 沒啥技術含量.

What is Samba?

這個歷史悠久了

Since 1992, Samba has provided secure, stable and fast file and print services
for all clients using the SMB/CIFS protocol, such as all versions of DOS and
Windows, OS/2, Linux and many others.

財務有個需求

- 3個賬號
admin    管理員用
opeople  已在員工用
npeople  新來員工用

- 3個文件夾
CW-No.1
CW-No.2
CW-Public 

- 權限要求
admin可以讀寫所有文件夾
opeople可以讀寫CW-No.2 CW-Public
npeople可以讀寫CW-Public

smb設置

yum install samba samba-client

$ cat /etc/samba/smb.conf
[global]
  workgroup = WORKGROUP
  server string = linux file share

[CW-No.1]
  comment = caiwu1
  path = /home/CW-No.1
  #valid users = admin
  #write list = admin
  #read list = admin
  #valid users = @caiwu
  valid users = admin,opeople
  write list = admin,opeople
  read list = admin,opeople


[CW-No.2]
  comment = caiwu2
  path = /home/CW-No.2
  #valid users = @caiwu
  valid users = admin
  write list = admin
  read list = admin


[CW-Public]
  comment = publice
  path = /home/CW-Public
  public = yes 
  writable = yes
  read only = no
  create mode = 0777
  force create mode = 0777
  directory mode = 0777
  force directory mode = 0777


- 本地測試掛載

smbclient //127.0.0.1/CW-Public -U opeople%opeople123


- 添加smb用戶並設置密碼

useradd opeople -g caiwu -s /sbin/nologin -M
smbpasswd -a opeople


- 查看smb已有用戶
pdbedit -L

docker安裝: 端口 tcp 135 449

可以快速的啟動一個共享目錄

sudo docker run -it -p 139:139 -p 445:445 -d dperson/samba             -u "example1;badpass"             -u "example2;badpass"             -s "public;/share"             -s "users;/srv;no;no;no;example1,example2"             -s "example1 private;/example1;no;no;no;example1"             -s "example2 private;/example2;no;no;no;example2"

todo: 這裏有個kingate,有趣的反帶軟件,抽時間可以研究下
http://www.361way.com/install-kingate-proxy/2801.html

[svc]samba服務搭建