[[email protected] ~]# yum -y install samba
配置samba服务器
1.备份配置文件
[[email protected] ~]# cd /etc/samba/ [[email protected] samba]# lslmhosts smb.conf smbusers [[email protected] samba]# cp smb.conf smb.conf.bak
2、在配置文件末尾添加如下代码
[[email protected] samba]# tail -4 smb.conf [ms] #共享文件名称 comment = ms #内容描述 path = /data/ms #配置访问路径 writable = yes #可写权限 vaild users = ms #授权用户,可授权多个,用“,”隔开
3、添加系统用户
[[email protected] home]# passwd ms Changing password for user ms. New password: Retype new password: passwd: all authentication tokens updated successfully.
4、创建访问目录并授权
[[email protected] data]# ls backup bin ifengsite logs script soft [[email protected] data]# mkdir ms [[email protected] data]# chown -R ifeng_ms.ifeng_ms ifeng_ms/ [[email protected] data]# chmod 777 ifeng_ms
5、创建samb用户
[[email protected] data]# smbpasswd -a ms New SMB password: Retype new SMB password: Added user ms.
6、重启samb服务使配置文件生效
[[email protected] data]# /etc/init.d/smb restart Shutting down SMB services: [ OK ] Starting SMB services:
7、关闭防火墙和selinux
[[email protected] ~]# /etc/init.d/iptables stop [[email protected] ~]# setenforce 0 setenforce: SELinux is disabled [[email protected] ~]# sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config
8、客户端测试
地址栏输入\\ip\访问模块,弹出用户名密码框,输入正确即可看到如下界面。
时间: 2024-10-13 04:53:11