1. 安裝samba
[root@localhost ~]# yum -y install samba
2. 創(chuàng)建需要共享的目錄
[root@localhost ~]# cd /home/
[root@localhost home]# mkdir test1
[root@localhost home]# mkdir test2
[root@localhost home]# cd test1
[root@localhost test1]# vi 1.txt
11111
[root@localhost home]# cd test2/
[root@localhost test2]# vi 2.txt
2222
3. 創(chuàng)建samba用戶
[root@localhost ~]# useradd samba
[root@localhost ~]# passwd samba
4. 給用戶samba授權(quán)
[root@localhost home]# chown -R samba:samba /home/
5. 新增samba中的用戶
需要是在linux系統(tǒng)中已存在的用戶
[root@localhost home]# smbpasswd -a samba
6. 修改smb.conf
[ ]中是共享文件名顯示值,跟實(shí)際目錄無關(guān)
[root@localhost home]# vi /etc/samba/smb.conf
[global]
workgroup=BIGCLOUD
netbios name=ZZSRV2
server string=Samba Server
security=user
map to guest = Bad User
dos charset=cp936
unix charset=gb2312
[dir1]
path = /home/test1/
public = no
writable = yes
write list = @samba
validusers = @samba
[dir2]
path = /home/test2/
public = no
writable = yes
write list = @samba
validusers = @samba
7. 重啟samba服務(wù)
[root@localhost home]# service smb restart
8. 注意事項(xiàng)
- 修改了配置丹莲、新增或修改用戶都需要重啟服務(wù)才生效。
- 如果后期正常使用情況下肴熏,修改了用戶密碼,造成window連接不上乔遮,可以嘗試在管理員權(quán)限下打開cmd命令窗口扮超,執(zhí)行該命令:
net use * /del /y
- linux系統(tǒng)用戶samba,與samba中的用戶,最好同密碼蹋肮,可以避免很多問題