@2013/5/1
@2013/12/18 - revise 1
参考文章:http://wenku.baidu.com/view/eb333a0a6c85ec3a87c2c50f.html :安装rpm包及防火墙设置、关闭selinux
http://www.linuxidc.com/Linux/2011-03/33636.htm :设置共享目录及使能smb服务
1.安装软件
利用命令“rpm -qa | grep samba”查看本系统中是否安装了samba服务器软件:
[root@zx Packages]#
[root@zx Packages]# rpm -qa | grep samba
samba-3.2.4-0.22.fc10.i386
samba-winbind-3.2.4-0.22.fc10.i386
samba-common-3.2.4-0.22.fc10.i386
samba-client-3.2.4-0.22.fc10.i386
[root@zx Packages]#
(若果已经有了的话,则可以跳过安装这个步骤)
4个rpm文件包在fedora 10的光盘下:
/media/Fedora 10 i386 DVD/Packages
利用下述命令"rpm -ivh samba-*.rpm"分别安装这4个文件
[root@zx Packages]# rpm -ivh samba-
samba-3.2.4-0.22.fc10.i386.rpm samba-common-3.2.4-0.22.fc10.i386.rpm
samba-client-3.2.4-0.22.fc10.i386.rpm samba-winbind-3.2.4-0.22.fc10.i386.rpm
当安装“samba-3.2.4-0.22.fc10.i386.rpm”时可能会出现
[root@zx Packages]# rpm -ivh samba-3.2.4-0.22.fc10.i386.rpm
warning: samba-3.2.4-0.22.fc10.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4ebfc273
error: Failed dependencies:
perl(Convert::ASN1) is needed by samba-0:3.2.4-0.22.fc10.i386
这个错误,则只要安装“
perl-Convert-ASN1-0.21-3.fc9.noarch.rpm”后再重新安装,即可解决问题。
2.Samba配置
当装好上述软件之后,就可以对samba服务器进行配置。
在这里我选择了最简单的最直接的一种配置,配置如下:
2.1 关闭防火墙
利用“lokkit”命令
2.2 关闭selinux
编辑“/etc/sysconfig/selinux”文件,在该文件中找到“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 - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
2.3 配置smb.conf文件
这里我选用了最简单的一种方法:将/etc/samba/smb.conf配置文件中的最后一组配置生效(public)
就是如下所示:
# A publicly accessible directory, but read only, except for people in
# the "staff" group
[public]
comment = Public Stuff
path = /
public = yes
writable = yes
printable = no
write list = +staff
2.4 增加samba用户
利用命令“smbpasswd -a root”将root用户加入
[root@zx ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[root@zx ~]#
2.5 启动samba服务
利用如下两条命令启动fedora的samba服务:
[root@zx ~]# /etc/init.d/smb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]
[root@zx ~]# /etc/init.d/nmb restart
Shutting down NMB services: [ OK ]
Starting NMB services: [ OK ]
[root@zx ~]#
3 测试
完成上述配置后,处于同一局域网的电脑应该就可以用samba方式访问Fedora机器了。
3.1 利用SecureCRT登陆
3.2 在windows下访问Fedora
在win系统下的运行“\\192.168.142.4”(fedora的ip地址)即可实现访问fedora的文件系统。(这是因为在前述的smb.conf配置文件中选择了共享根文件系统)