1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| # 查看安装状况 rpm -qa |grep samba
# 安装:能连接互联网情况下 yum -y install samba
# 下载:未联网情况下 # 下载并拷贝到服务器上:输入samba、centos搜索,选择 el7 下载【当前centos7】 # http://www.rpmfind.net/linux/rpm2html/search.php?query=&submit=Search+...&system=&arch=
# 安装 rpm -ivh samba-4.10.16-5.el7.x86_64.rpm
# 开机启动 systemctl enable smb.service systemctl enable nmb.service
# 启动 systemctl restart smb.service # 查看状态 systemctl status smb.service
# 测试smb.conf配置是否正确 testparm
# 修改配置 vim /etc/samba/smb.conf # 新增内容 [public] comment = public stuff # 分享目录 path = /usr/local/nginx/html browseable = yes guest ok = yes writeable = yes public=yes
# 文件夹读写权限 chmod -R 777 /usr/local/nginx/html
# 创建一个 samba 专用账户 admin useradd admin # 密码 admin123456 smbpasswd -a admin
# 防火墙端口 firewall-cmd --zone=public --add-port=445/tcp --permanent firewall-cmd --reload
# 访问,使用 admin 登陆 \\192.168.0.56\public
|