Linux samba配置与使用(fedora 22)

Fedora 22环境下:

配置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/public
  chmod 777 /home/public

在etc/samba/smb.conf中增加:

[share]
        comment = Galen's Share
        path = /home/public
        writable = yes
        valid users = your_username          # 你可以运行 whoami 查看你的用户名


#setsebool -P samba_enable_home_dirs on命令解除selinux对samba的限制。


配置好后,重启samba (sudo systemctl restart smb.service)


关闭 防火墙

sudo systemctl stop firewalld.service
sudo 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端:

通过命令行输入IP地址就可以访问对应的共享文件夹。

(WIN7采用NTLMv2认证,需要经过一些设置:


    开始->运行->secpol.msc->本地策略->安全选项->网络安全:LAN管理器身份验证级别->发送 LM 和 NTLMv2 ,如果已协商,则使用NTLMv2 (会话安全 &)->完成设置。


systemctl list-unit-files命令用于查看服务状态。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值