关闭防火墙 关闭selinux
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
yum install samba
[root@localhost ]# yum install samba
配置/etc/samba/smb.conf文件
参考:
[global]
workgroup = WORKGROUP
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
include = /etc/samba/dhcp.conf
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
usershare allow guests = yes
security = user
guest ok = yes
guest account=root
hosts allow=10.40.120.100
[root]
path = /root
public = yes
writeable = yes
read only = no
browsable = yes
[home]
path = /home
public = yes
writeable = yes
read only = no
browsable = yes
启动smb服务:
[root@localhost samba]# systemctl start smb
[root@localhost samba]# systemctl status smb
到此可以试试能否连接。
如果不能连接再创建个smb用户试试:
[root@localhost share]# groupadd test -g 6000
[root@localhost share]# useradd test -u 6000 -g 6000 -s /sbin/nologin -d /dev/null
[root@localhost share]# smbpasswd -a test