安装Samba
- rpm -qa|grep samba
- yum install samba
关闭selinux和防火墙
- setenforce 0
- sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
- systemctl stop firewalld
- systemctl disable firewalld
启动samba
- systemctl start smb
配置Samba服务
- cd /home/
- mkdir logger shared
- useradd -s /sbin/nologin logadmin
- useradd -g logadmin -s /sbin/nologin loguser
- useradd -s /sbin/nologin admin
- useradd -g admin -s /sbin/nologin shared
建立Samba用户
- – smbpasswd -a logadmin
- – smbpasswd -a loguser
- – smbpasswd -a admin
- – smbpasswd -a shared
更改目录属性
- chown logadmin.logadmin logger
- chown admin.admin shared
- chmod -R 777 logger
- chmod -R 777 shared
查看Samba配置文件
samba文件共享默认配置文件存放于/etc/samba/smb.conf下, 用于配置Samba服务内容。
- [global]
- workgroup = SC.LOCAL
- server string = Samba Server Version %v
- netbios name = Linuxidc-Server
- log file = /var/log/samba/%m.log
- max log size = 10240
- security = user
- passdb backend = tdbsam
- [logger]
- comment = Logs Directories
- path = /home/logger/
- public = no
- admin users = logadmin
- valid users = @logadmin
- browseable = yes
- writable = yes
- create mask = 0777
- directory mask = 0777
- force directory mode = 0777
- force create mode = 0777
- [shared]
- # 共享文件目录描述
- comment = Shared Directories
- # 共享文件目录
- path = /home/shared/
- # 是否允许guest访问
- public = no
- # 指定管理用户
- admin users = admin
- # 可访问的用户组、用户
- valid users = @admin
- # 是否浏览权限
- browseable = yes
- # 是否可写权限
- writable = yes
- # 文件权限设置
- create mask = 0777
- directory mask = 0777
- force directory mode = 0777
- force create mode = 0777
修改完Samba配置文件后,需要重启Samba服务配置才能生效
- systemctl restart smb
- systemctl status smb
get小知识:进入cmd命令输入
- C:\>net use * /del /y
断开与samba服务的所有共享连接。
更多相关文章
版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
评论