目錄
1 安裝samba
2 修改Samba配置文件
3 增加Rose用戶的samba帳號
4 重啟samba
5 測試
1 安裝samba
使用如下命令安裝samba:
sudo apt-get updatesudo apt-get install samba openssh-server
2 修改Samba配置文件
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.ba# 打開文件sudo vim /etc/samba/smb.conf
- 修改 ①
文件中的[homes]項內容默認是注釋掉的,我們取消注釋,修改成如下:
#======================= Share Definitions =======================# Un-comment the following (and tweak the other settings below to suit)# to enable the default home directory shares. This will share each# user's home directory as \\server\username[homes]comment = Home Directoriesbrowseable = no# 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 = yes# 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 = 0700# 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 = 0700# 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# This might need tweaking when using external authentication schemesvalid users = %S
- 修改 ②?
說明:用于指定共享的具體路徑。
在文件的末尾,追加如下內容:
[test]comment = Shared smb_basepath = /home/test/create mask = 0755directory mask = 0755writable = yesvalid users = Rosebrowseable = yes
如上修改完成后wq保存退出!
3 增加Rose用戶的samba帳號
Rose為用戶名,給Rose開通samba帳號的命令如下:
sudo smbpasswd -a Rose
然后根據提示設置對應的密碼即可。
4 重啟samba
sudo service smbd restart && service nmbd restart
5 測試
在Windows下輸入samba地址嘗試登錄:
示例如下:
\\你要連接的電腦的IP地址\test
然后,輸入用戶名Rose和對應的密碼就可以訪問共享的文件夾了。。。
至此,本文分享的內容就結束啦!遇見便是緣,感恩遇見 !!!💛 💙 💜 ?? 💚 💛 💙 💜 ?? 💚