我配置的时候全程在root里面操作的:
su - #进入root用户
配置samba:
安装samba service
yum install samba.service
开始配置samba:
smbpasswd -a -U your_username #设置登陆的用户名和密码,你可以运行 whoami 查看你的用户名
systemctl enable smb.service # 开机启动samba
systemctl start smb.service # 立即启动samba
systemctl restart smb.service # 立即重启samba
firewall-cmd --permanent --zone=public --add-service=samba # 配置防火墙
增加共享文件夹:
mkdir /home/share
chmod 777 /home/share #使share文件夹可读可写
在etc/samba/smb.conf中增加:
[share]
comment = share
path = /home/share
writable = yes
valid users = your_username # 你可以运行 whoami 查看你的用户名
#setsebool -P samba_enable_home_dirs on #命令解除selinux对samba的限制
关闭 防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
停止SELinux(如果不需要它)
vi /etc/sysconfig/selinux
# 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 - SELinux is fully disabled.
SELINUX= disabled # change here
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
(
sestatus -v可以查看selinux状态。
getenforce也可以。
setenforce命令可以临时关闭selinux,不需要重启。
)
另外关闭windows的防火墙
使用ifcongfig查看ip
在windows随便一个文件夹下输入ip就可以登录进去啦。