服务端安装
yum install samba samba-client samba-common -y
配置
vim /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
netbios name = centos
# 自定义端口
smb ports = 13501 13502
[p2presources]
comment = p2presources
path = /www/wwwroot/p2presources
valid users = @www
admin users = @www
browseable = yes
public = yes
write list = @www
create mask = 0777
directory mask = 0777
用户添加
useradd www
groupadd www
usermod -a -G www www
smbpasswd -a www
文件夹权限设定
chown -R www:www /p2presources
chmod -R 0775 /p2presources
开启服务
systemctl enable smb.service
systemctl enable nmb.service
systemctl start smb.service
systemctl start nmb.service
客户端安装
yum -y install cifs-utils
挂载
- 手动挂载
sudo mount -t cifs -o port="13501",username="www",password="www" //192.168.20.2/p2presources /p2presources/
- 自动挂载
vim /etc/fstab
//192.169.20.2/p2presources /p2presources cifs uid=1006,username=www,password=www,port=13501 0 0
需要防火墙开放相关端口
网友评论