centos 7安裝samba 設定檔案共享
阿新 • • 發佈:2021-12-09
1、檢查是否已經安裝
rpm -qa |grep samba
2、安裝
yum -y install samba
3、配置samba
修改之前先備份下 cp /etc/samba/smb.conf /etc/samba/smb.back.conf
vim /etc/samba/smb.conf
配置檔案的內容如下,其他的可以直接刪除([axure]代表的是共享檔名):
注意:不要使用security = share 也不要使用,也不要配置guest,window 10安全策略不允許,需要配置賬戶
[global] workgroup = SAMBA log file = /var/log/samba/log.%m max log size = 50 passdb backend = tdbsam printing = cups printcap name = cups load printers = no cups options = raw security = user #map to guest = bad user [axure] comment= Axure share path = /data/axure public = no writable = yes available = yes browsable = yes create mask = 0777 directory mask = 0777
儲存後用testparm
驗證配置檔案是否正確
4、配置使用者
- 新增系統使用者(使用者名稱為axure ,如果檔案使用者home存在的話也沒關係)
useradd -d /data/axure -s /sbin/nologin axure
- 把使用者新增到samba使用者,填2次密碼確定
pdbedit -a -u axure
5、建立檔案和設定許可權
mkdir /data/axure
chmod 777 /data/axure
6、配置samba開啟啟動和重啟等
systemctl enable smb systemctl start smb systemctl status smb systemctl restart smb
7、訪問共享檔案
- window:win+r直接\\ip 填賬號密碼就行了
- mac:訪達->前往->連線伺服器 smb://ip