samba安裝和簡單配置使用
阿新 • • 發佈:2021-10-27
1.安裝
1.1.安裝軟體
yum install samba
1.2.啟動服務
systemctl start smb
systemctl status smb
systemctl enable smb
1.3.建立使用者和目錄
groupadd sales
useradd -g sales sales
passwd sales
mkdir -p /data/samba/sales
chown -R sales.sales /data/samba/sales
1.3.修改配置檔案
mv /etc/samba/smb.conf /etc/samba/smb.conf.orig # 可以看smb.conf.example檢視配置檔案的選項和含義 vi /etc/samba/smb.conf ################################################### [global] workgroup = sales server string = Samba Server Version %v netbios name = SalesSamba log file = /var/log/samba/log.%m security = user [sales] comment = direcotry for sales path = /Data/samba/sales writable = yes valid users = sales ################################################### testparm systemctl restart smb smbpasswd -a sales
2.使用
2.1.Windows
\\xxx.xxx.xxx.xxx\sales
2.2.Linux
# 設定UID和GID後,/mnt目錄的許可權就是這個使用者和組
mount -t cifs -o username=sales,password=sales,uid=54321,gid=54322 //xxx.xxx.xxx.xxx/sales /mnt