yum -y install samba-client samba-common cifs-utils samba
cat /dev/null > /etc/samba/smb.conf
vim /etc/samba/smb.conf
[global] workgroup = SAMBA security = user passdb backend = tdbsam printing = cups printcap name = cups load printers = yes cups options = raw [logs] comment = logs path = /opt/logs/(指定共享路径) browseable = yes read only = yes guest ok = yes
iptables需要放行如下端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT -A INPUT -p udp -m state --state NEW -m udp --dport 137 -j ACCEPT -A INPUT -p udp -m state --state NEW -m udp --dport 138 -j ACCEPT
创建用户,这里创建系统用户就行了,用useradd smbuser命令创建即可,但是重置密码的时候需要用smbpasswd -a smbuser命令
systemctl restart smb
打开机器文件夹\ip 输入创建的账号密码即可