歡迎您光臨本站 註冊首頁

關於security = share的問題

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

關於security = share的問題

當把security = share這樣設置時,登陸samba是不需要用戶名和密碼的,但不知道能不能用指定的用戶名和密碼登陸呢?就是能不能登陸到指定用戶名的主目錄呢?
《解決方案》

原帖由 qingkong9416 於 2009-4-22 17:21 發表 http://bbs3.chinaunix.net/images/common/back.gif
當把security = share這樣設置時,登陸samba是不需要用戶名和密碼的,但不知道能不能用指定的用戶名和密碼登陸呢?就是能不能登陸到指定用戶名的主目錄呢?

如果要指定用戶,用security = user ,為什麼要用share呢?
《解決方案》

我是想即可以匿名訪問,也可以以用戶名和密碼的方式登錄自己的主目錄
《解決方案》

原帖由 qingkong9416 於 2009-4-23 09:00 發表 http://bbs2.chinaunix.net/images/common/back.gif
我是想即可以匿名訪問,也可以以用戶名和密碼的方式登錄自己的主目錄


如果是在win的話,登陸一次,密碼保存了,下次就不用輸入密碼了。
《解決方案》

net use \\samba伺服器IP地址\IPC$ /delete 可以刪除上一次建立的連接

我的意思是,讓有的人只能以匿名的方式訪問伺服器,只能訪問公共文件夾,而有的人可以以用戶名和密碼的方式訪問伺服器,即可以訪問公共文件夾,也可以訪問自己的主目錄。

呵呵~~,不知道能不能實現這樣的功能

[ 本帖最後由 qingkong9416 於 2009-4-23 11:45 編輯 ]
《解決方案》

原帖由 qingkong9416 於 2009-4-23 10:55 發表 http://bbs2.chinaunix.net/images/common/back.gif
net use \\samba伺服器IP地址\IPC$ /delete 可以刪除上一次建立的連接

我的意思是,讓有的人只能以匿名的方式訪問伺服器,只能訪問公共文件夾,而有的人可以以用戶名和密碼的方式訪問伺服器,即可以訪問公共 ...
http://bbs2.chinaunix.net/thread-1098863-1-1.html
《解決方案》

去看看,不明白再回來問
《解決方案》

原帖由 qingkong9416 於 2009-4-23 12:23 發表 http://bbs2.chinaunix.net/images/common/back.gif
去看看,不明白再回來問


研究有結果了嗎?:mrgreen:
《解決方案》

i770880 的帖子,不錯

可以這樣實現lz的需要

   security = user
時,加一句

  map to guest = bad user  

1,沒有帳戶的人,通過\\ip 登陸公共帳戶。


2, 有帳戶的人,通過\\ip\用戶名    登陸自己的目錄。再點擊向上可以進入公共目錄。

       但這樣,win有個不好的地方就是,如果輸入密碼錯誤了,您就登陸不了,除非您重啟電腦,或者執行  net use * /delete 關掉前一次連接。
《解決方案》

匿名用戶與普通用戶併發登錄samba伺服器

需要實現功能

    * 一個文件伺服器通過\\ip或者\\name訪問,不輸入密碼即能查看到根下的目錄;

    * 要匿名找文件的直接點進去各個目錄裡面拷貝文件,不能刪除;

    *單個目錄由單個帳號在多台計算機上進行內容維護,即可以刪除修改新建之類,這些帳號由密碼保護。

    *有多台電腦使用同一個帳號要往共享目錄裡面寫東西,這幾個電腦的操作員都不希望自己知道這個密碼。

測試實現過程

首先考慮使用 security = share 這種方式,經測試,此方式可以較好實現匿名訪問只讀,但是涉及到寫操作就出現無法與授權用戶區分的問題。具體如下:

        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 參數不可用,即 security = share 無法滿足需求。

只能使用 security = user 進行嘗試。

匿名用戶與普通用戶併發登錄samba伺服器--ZT公社古公的samba力作

6樓實現的原理是先匿名訪問文件共享伺服器,需要獲取目錄寫許可權時,首先訪問一下需要許可權的某個目錄如HOME,登陸了之後Windows系統就緩存了用戶名和密碼,這樣再訪問需要寫的目錄時就自動有用戶名和密碼進行了驗證(系統並無任何提示),這樣就從HOME目錄登陸過程中繼承了用戶登錄信息進而獲得了許可權。

從chinaunix帖子中可以總結出如下解決方法:

   1.      使用 map to guest = bad user 來實現匿名訪問文件伺服器根目錄列表,以避免訪問伺服器即需要輸入用戶和密碼的問題;
   2.      共享資源使用普通最小配置 guest ok = yes 及 write list 參數即可,需要注意目錄許可權及屬主問題;
   3.      配合Windows系統NET USE命令進行共享資源映射到盤符,使寫許可權的計算機不知道密碼也可以正常操作該共享目錄;


具體配置過程

# mkdir /data
# mkdir /data/lab
# adduser lab
# chown lab.lab /data/lab/
# smbpasswd -a lab
New SMB password:
Retype new SMB password:
Added user lab.

smb.conf配置文件

   security = user
   map to guest = Bad User


   comment = Lab Share
   path = /data/lab
   guest ok = yes
   write list  = lab

需要向裡面寫數據的三台機器使用命令一次設置映射網路驅動器,只要不主動斷開這個映射,以後一直都可以使用,/PERSISTENT:YES 參數表示記憶密碼映射狀態為永久。

命令如下:

net use x: \\file_server\lab  password /user:lab /PERSISTENT:YES

如有必要可能需要刪除現有連接參數及密碼:

net use * /delete

該共享的管理員可以將映射命令做成BAT文件,存在U盤上或者是直接發給需要設置寫許可權的計算機上運行。

如果此目錄的管理員需要在某個機器上臨時寫幾個文件進去,只需要瀏覽進HOME,登錄后再訪問lab共享,就可以寫文件了。

[火星人 ] 關於security = share的問題已經有419次圍觀

http://coctec.com/docs/service/show-post-22890.html