【個人筆記重點,不作爲參考】主題:ubuntu下的Samba配置:使每個用戶可以用自己的用戶名和密碼登錄自己的home目錄

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 #本行需要取消註釋

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

3. 重啓samba服務:

sudo service restart smbd

sudo service restart nmbd

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

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

sudo smbpasswd -a reddy

根據提示輸入兩次密碼即可。

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

\\10.0.0.2\reddy

6.此時windows應該會彈出窗口要求輸入用戶名和密碼了,輸入吧。Enjoy!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章