使用方法如下:

上传脚本到linux服务器授权

Centos6.5下通过shell脚本快速安装samba服务器

Centos6.5下通过shell脚本快速安装samba服务器

Centos6.5下通过shell脚本快速安装samba服务器

脚本如下:

#!/bin/sh
yum -y install samba samba-client
echo -e "thinkive\nthinkive" | smbpasswd -s -a root
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
touch /etc/samba/smb.conf
cat > /etc/samba/smb.conf  << EOF
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = SambaServer
log file = /var/log/samba/%m.log
max log size = 50
security = user
[thinkive]
path = /
writeable = yes
valid user = root
browseable = yes
EOF

#新增入站规则
#iptables -A INPUT -p tcp -m multiport --dports 139,445 -j ACCEPT
#iptables -A INPUT -p udp -m multiport --dports 137,138 -j ACCEPT
#新增出站规则
#iptables -A OUTPUT -p tcp -m multiport --sports 139,445 -j ACCEPT
#iptables -A OUTPUT -p tcp -m multiport --sports 137,138 -j ACCEPT
#iptables-save

#将下面语句加到/etc/rc.local中进行开机启动控制
/etc/init.d/smb restart
#/etc/init.d/ufw stop

 

相关文章:

  • 2021-05-19
  • 2021-09-29
  • 2021-06-27
  • 2021-11-06
  • 2021-04-11
  • 2022-12-23
  • 2021-09-22
  • 2021-09-07
猜你喜欢
  • 2021-05-24
  • 2021-11-20
  • 2021-12-19
  • 2022-01-11
  • 2022-12-23
  • 2021-09-23
  • 2021-06-29
相关资源
相似解决方案