1.環(huán)境準(zhǔn)備
檢查防火墻狀態(tài),若開(kāi)啟,則關(guān)閉防火墻:
image.png
image.png
關(guān)閉SELinux
vim /etc/selinux/config
設(shè)置SELINUX=disabled
2.檢查是否已預(yù)裝samba,若有,則卸載
[root@linux shell]# yum list installed | grep samba
samba-common.x86_64 3.6.23-51.el6 @anaconda-CentOS-201806291108.x86_64/6.10
samba-winbind.x86_64 3.6.23-51.el6 @anaconda-CentOS-201806291108.x86_64/6.10
samba-winbind-clients.x86_64
[root@linux shell]# yum remove samba-common.x86_64
卸載完再檢查下
[root@linux shell]# yum list installed | grep samba
3.安裝samba
[root@linux shell]# yum install samba samba-common samba-client
4.設(shè)置samba服務(wù)開(kāi)機(jī)啟動(dòng)
[root@linux shell]# chkconfig smb on
[root@linux shell]# chkconfig --list | grep smb
smb 0:關(guān)閉 1:關(guān)閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關(guān)閉
5.修改samba配置
[root@linux shell]# vim /etc/samba/smb.conf
配置訪問(wèn)的IP段
image.png
配置訪問(wèn)模式
image.png
配置共享文件夾
image.png
6.為samba設(shè)置訪問(wèn)用戶(hù)的密碼
啟動(dòng)samba服務(wù),訪問(wèn)samba的用戶(hù),即centos系統(tǒng)的登錄用戶(hù),所以只需設(shè)置訪問(wèn)samba的密碼即可.
[root@linux shell]# service smb start
smbpasswd -a 訪問(wèn)samba的密碼
smbpasswd命令的選項(xiàng)說(shuō)明
-a :添加系統(tǒng)用戶(hù)為samba用戶(hù)
-d : 禁用
-e : 啟用
-x :刪除
7.設(shè)置共享文件夾的權(quán)限chmod
8.重啟centos:reboot
9.到windows上登錄samba共享文件夾
image.png