1 安装
$ sudo yum install samba
首先修改配置文件/etc/samba/smb.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [global] workgroup = WORKGROUP security = user encrypt passwords = yes passdb backend = smbpasswd map to guest = Bad User usershare allow guests = Yes ntlm auth = yes create mask = 644 # force create mode = 644 [yuanjianpeng] comment = yuanjianpeng home directory path = /work read only = no browseable = yes writable = yes valid users = yjp |
2 添加用户
$ sudo smbpasswd -a yjp
3 启动服务
$ systemctl start smb.service
在Fedora内部访问看看
$ smbclient --user=yjp //localhost/yuanjianpeng
lpcfg_do_global_parameter: WARNING: The "encrypt passwords" option is deprecated
Enter WORKGROUP\yjp's password:
Try "help" to get a list of possible commands.
smb: \> ls
NT_STATUS_ACCESS_DENIED listing \*
smb: \>
首先这个路径必须是带上yuanjianpeng,这个smb.conf里面的[yuanjianpeng],输入密码,发现可以连接上去,但是执行ls没有权限。需要关闭SELinux。
4 关闭SELinux
$ getenforce
Enforcing
$ sudo setenforce 0
这样在Fedora内部就可以访问了。但是在windows无法访问,抓包发现tcp连接到445端口被拒绝,需要关闭防火墙。
5 防火墙允许通过
$ firewall-cmd --get-active-zoneshttps://docs.fedoraproject.org/en-US/quick-docs/samba/