一,安装samba,首先要保证自己的linux和windows相互能ping通
Linux下查看ip地址命令:ifconfig
修改ip地址命令:ifconfig eth0 192.168.xx.xx
windows下查看ip地址命令:ipconfig
相互能ping通的前提是两者IP地址得在同一网段
二、查看是否安装samba,命令为:rpm -qa | grep samba
如果系统提示找不到命令:则运行命令su - 试试
出现如下包表示已经安装,否则没有安装
- samba-winbind-clients-3.5.10-125.el6.i686
- samba-client-3.5.10-125.el6.i686
- samba-common-3.5.10-125.el6.i686
- samba-3.5.10-125.el6.i686
samba-winbind-clients-3.5.10-125.el6.i686
samba-client-3.5.10-125.el6.i686
samba-common-3.5.10-125.el6.i686
samba-3.5.10-125.el6.i686
也可用一下命令来卸载:
二、安装samba服务器,找到这三个软件包 ,把他放到一个你自己创建的目录里,然后到这目录去安装
- samba-3.5.10-125.el6.i686.rpm
- samba-common-3.5.10-125.el6.i686.rpm
- samba-client-3.5.10-125.el6.i686.rpm
samba-3.5.10-125.el6.i686.rpm
samba-common-3.5.10-125.el6.i686.rpm
samba-client-3.5.10-125.el6.i686.rpm
1、先装samba-common-3.5.10-125.el6.i686.rpm 注意顺序了
命令为:rpm -ivh samba-common-3.5.10-125.el6.i686.rpm
2、然后依次安装另外两个,显示信息如下:
三、接下来就是配置samba,这个比较简单不再赘述
配置Samba
/etc/samba/smb.conf
[root]
comment = Root Directories
browseable = yes
writable = yes
path = /
valid user = pm
添加一个用户名
useradd smb // 添加smb系统用户
smbpasswd -a pm // 修改密码
重启samba
/etc/init.d/smb restart
注意:
1、记得重启网络 : /etc/init.d/network restart,还有重启系统,才能生效
2、启动samba : service smb start
3、在ping的通的前提下做这些事情!
四、
在linux的Samba服务中,不能创建文件夹和文本文件_解决办法
关闭SElinux可以解决: 关闭 SElinux方法:
使用文本编辑工具打开 /etc/selinux/config: vi /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 - SELinux is fully disabled. SELINUX=enforcing
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:SELINUX=disabled 保存,关闭。 重启系统。
# 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=enforcing SELINUX=disabled
最后还是发现在windows下输入账号密码之后登不进去
解决:把配置文件里的user改成share
或者解决方法:security = user 后面加
map to guest=Bad User
另外
Samba如何设置登录时不输入账号和密码 1.在[global]中添加 guest account = nobody 2.在共享中设置 guest ok = yes 或者 public = yes 或者 only guest = yes 3.重启smb服务 service smb restart
就可以登进去了
或者
最后发现自己的samba用户文件夹下可以正常使用,其他的不能进行创建文件夹等的访问