ubuntu下的Samba配置:使每個用戶可以用自己的用戶名和密碼登錄自己的home目錄


http://blog.csdn.net/fly_qj/article/details/21744797

 

1.先要安裝Samba

sudo apt-get install samba openssh-server

2.編譯Samba配置文件

sudo vi /etc/samba/smb.conf

找到[homes]項,此項默認是注釋掉的,取消其注釋,然后修改其具體內容,修改成如下:

[homes]
   comment = Home Directories
   browseable = yes
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0755 #建議將權限修改成0755,這樣其它用戶只是不能修改
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0755
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# The following parameter makes sure that only "username" can connect
#
# This might need tweaking when using external authentication schemes
   valid users = %S #本行需要取消注釋,%s  是指登陸用戶可以訪問 

如上修改完成后wq保存退出!

3. 重啟samba服務:

sudo service restart smbd

sudo service restart nmbd

這里重啟我用的是

sudo /etc/init.d/smbd restart

sudo /etc/init.d/nmbd restart

4. 增加一個現有用戶的對應samba帳號:

如我已經有一個用戶叫liuyan,現在給liuyan開通samba帳號:

sudo smbpasswd -a liuyan

根據提示輸入兩次密碼即可(這個密碼就是系統登陸賬戶liuyan的密碼)

5.現在可以測試了,在Window下輸入samba地址嘗試登錄:

\\10.0.0.2\reddy

6.此時windows應該會彈出窗口要求輸入用戶名和密碼了,輸入吧。Enjoy!如果沒有提示輸入密碼,請重啟Windows系統

 

注:本文章對Ubuntu_64_15.10設置成功,window輸入密碼后可以讀、寫文件。

  對Ubuntu_64_14.04設置失敗了,window輸入密碼后,不能對共享文件夾進行讀、寫操作。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM