- 論壇徽章:
- 0
|
匿名用戶與普通用戶并發(fā)登錄samba服務(wù)器
需要實現(xiàn)功能
* 一個文件服務(wù)器通過\\ip或者\\name訪問,不輸入密碼即能查看到根下的目錄;
* 要匿名找文件的直接點進(jìn)去各個目錄里面拷貝文件,不能刪除;
*單個目錄由單個帳號在多臺計算機上進(jìn)行內(nèi)容維護,即可以刪除修改新建之類,這些帳號由密碼保護。
*有多臺電腦使用同一個帳號要往共享目錄里面寫東西,這幾個電腦的操作員都不希望自己知道這個密碼。
測試實現(xiàn)過程
首先考慮使用 security = share 這種方式,經(jīng)測試,此方式可以較好實現(xiàn)匿名訪問只讀,但是涉及到寫操作就出現(xiàn)無法與授權(quán)用戶區(qū)分的問題。具體如下:
writeable (S)
Inverted synonym for read only.
read only (S)
An inverted synonym is writeable.
If this parameter is yes, then users of a service may not create or modify files in the service
directory.
Note that a printable service (printable = yes) will ALWAYS allow writing to the directory (user
privileges permitting), but only via spooling operations.
Default: read only = yes
write list (S)
This is a list of users that are given read-write access to a service. If the connecting user is in
this list then they will be given write access, no matter what the read only option is set to. The
list can include group names using the @group syntax.
Note that if a user is in both the read list and the write list then they will be given write
access.
By design, this parameter will not work with the security = share in Samba 3.0.
Default: write list =
Example: write list = admin, root, @staff
“By design, this parameter will not work with the security = share in Samba 3.0.” 意味著 security = share 這種方式的 write list 參數(shù)不可用,即 security = share 無法滿足需求。
只能使用 security = user 進(jìn)行嘗試。
匿名用戶與普通用戶并發(fā)登錄samba服務(wù)器--ZT公社古公的samba力作
6樓實現(xiàn)的原理是先匿名訪問文件共享服務(wù)器,需要獲取目錄寫權(quán)限時,首先訪問一下需要權(quán)限的某個目錄如HOME,登陸了之后Windows系統(tǒng)就緩存了用戶名和密碼,這樣再訪問需要寫的目錄時就自動有用戶名和密碼進(jìn)行了驗證(系統(tǒng)并無任何提示),這樣就從HOME目錄登陸過程中繼承了用戶登錄信息進(jìn)而獲得了權(quán)限。
從chinaunix帖子中可以總結(jié)出如下解決方法:
1. 使用 map to guest = bad user 來實現(xiàn)匿名訪問文件服務(wù)器根目錄列表,以避免訪問服務(wù)器即需要輸入用戶和密碼的問題;
2. 共享資源使用普通最小配置 guest ok = yes 及 write list 參數(shù)即可,需要注意目錄權(quán)限及屬主問題;
3. 配合Windows系統(tǒng)NET USE命令進(jìn)行共享資源映射到盤符,使寫權(quán)限的計算機不知道密碼也可以正常操作該共享目錄;
具體配置過程
[root@mail samba]# mkdir /data
[root@mail samba]# mkdir /data/lab
[root@mail samba]# adduser lab
[root@mail samba]# chown lab.lab /data/lab/
[root@mail samba]# smbpasswd -a lab
New SMB password:
Retype new SMB password:
Added user lab.
smb.conf配置文件
security = user
map to guest = Bad User
[lab]
comment = Lab Share
path = /data/lab
guest ok = yes
write list = lab
需要向里面寫數(shù)據(jù)的三臺機器使用命令一次設(shè)置映射網(wǎng)絡(luò)驅(qū)動器,只要不主動斷開這個映射,以后一直都可以使用,/PERSISTENT:YES 參數(shù)表示記憶密碼映射狀態(tài)為永久。
命令如下:
net use x: \\file_server\lab password /user:lab /PERSISTENT:YES
如有必要可能需要刪除現(xiàn)有連接參數(shù)及密碼:
net use * /delete
該共享的管理員可以將映射命令做成BAT文件,存在U盤上或者是直接發(fā)給需要設(shè)置寫權(quán)限的計算機上運行。
如果此目錄的管理員需要在某個機器上臨時寫幾個文件進(jìn)去,只需要瀏覽進(jìn)HOME,登錄后再訪問lab共享,就可以寫文件了。 |
|