分类: LINUX
2010-02-25 17:22:46
在RHEL 5操作系统中要实现和windows操作系统的文件共享,可以在RHEL 5上使用nfs,但是必须在windows上安装相关的软件,且该软件一般需要付费!故此种办法实用性不高,那有没有一种更好的解决办法呢?答案是肯定 的,下面将具体介绍这种比较实用的办法。
在windows主机之间进行网络文件共享是通过使用微软公司自己的CIFS服务实现的 CIFSCommonInternetFileSystem的缩写,可以从一台windows主机直接访问网络中的其他主机的共享文件夹,CIFS最典型 的应用是能够在“网上邻居”中找带其他主机并访问其中的共享文件。
一直以来windows主机之间都使用SMB/CIFS网络协议实现文件和打印资源的共享。由于SMB/CIFS是微软的私有协议,所以无法直 接与RHEL 5系统进行通信,直到Samba项目的出现。通过RHEL 5下Samba的搭建和Samba客户机软件,完全可以实现RHEL 5主机和widows主机之间的双向文件共享。
下面来简单的介绍一下RHEL 5 Samba服务器搭建的过程:
◆[root@Linserv~]#rpm-qa|grepsamba
◆[root@Linserv~]#mount/dev/cdrom/mnt
mount:blockdevice/dev/cdromiswrite-protected,mountingread-only
◆[root@Linserv~]#rpm-ivh/mnt/Server/samba-3.0.23c-2.i386.rpm
warning:/mnt/Server/samba-3.0.23c-2.i386.rpm:HeaderV3DSAsignature:NOKEY,keyID37017186
error:Faileddependencies:
samba-common=0:3.0.23c-2isneededbysamba-3.0.23c-2.i386
◆[root@Linserv~]#eject
◆[root@Linserv~]#!mou
mount/dev/cdrom/mnt
mount:blockdevice/dev/cdromiswrite-protected,mountingread-only
◆[root@Linserv~]#rpm-ivh/mnt/Server/samba-common-3.0.23c-2.i386.rpm
warning:/mnt/Server/samba-common-3.0.23c-2.i386.rpm:HeaderV3DSAsignature:NOKEY,keyID37017186
Preparing...###########################################[100%]
1:samba-common###########################################[100%]
◆[root@Linserv~]#mount/dev/cdrom/mnt
mount:blockdevice/dev/cdromiswrite-protected,mountingread-only
◆[root@Linserv~]#rpm-ivh/mnt/Server/samba-3.0.23c-2.i386.rpm
warning:/mnt/Server/samba-3.0.23c-2.i386.rpm:HeaderV3DSAsignature:NOKEY,keyID37017186
Preparing...###########################################[100%]
1:samba###########################################[100%]
◆[root@Linserv~]#vi/etc/samba/smb.conf
[global]
workgroup=MYGROUP
serverstring=SambaServer
security=user
loadprinters=yes
cupsoptions=raw
logfile=/var/log/samba/%m.log
maxlogsize=50
dnsproxy=no
[homes]
comment=HomeDirectories
browseable=no
writable=yes
[printers]
comment=AllPrinters
path=/usr/spool/samba
browseable=no
guestok=no
writable=no
printable=yes
[public]
path=/home/public
public=yes
onlyguest=yes
writeable=no
◆[root@Linserv~]#servicesmbstart
StartingSMBservices:[OK]
StartingNMBservices:[OK]
◆[root@Linserv~]#mkdir/home/public
◆[root@Linserv~]#chownnobody:nobody/home/public/
◆[root@Linserv~]#vi/home/public/test.doc
◆[root@Linserv~]#useraddsamba1
◆[root@Linserv~]#useraddsamba2
◆[root@Linserv~]#tail/etc/passwd
rpc:x:32:32:PortmapperRPCuser:/:/sbin/nologin
sshd:x:74:74:Privilege-separatedSSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPCServiceUser:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:AnonymousNFSUser:/var/lib/nfs:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
a:x:500:500::/home/a:/bin/bash
b:x:501:501::/home/b:/bin/bash
virtual:x:502:502::/home/ftpsite:/bin/bash
samba1:x:503:503::/home/samba1:/bin/bash
samba2:x:504:504::/home/samba2:/bin/bash
◆[root@Linserv~]#cat/etc/samba/smbpasswd
◆[root@Linserv~]#smbpasswd-asamba1
NewSMBpassword:
RetypenewSMBpassword:
Addedusersamba1.
◆[root@Linserv~]#smbpasswd-asamba2
NewSMBpassword:
RetypenewSMBpassword:
Addedusersamba2.
◆[root@Linserv~]#cat/etc/samba/smbpasswd
samba1:503:CCF9155E3E7DB453AAD3B435B51404EE:3DBDE697D71690A769204BEB12283678::LCT-4921594C:
samba2:504:CCF9155E3E7DB453AAD3B435B51404EE:3DBDE697D71690A769204BEB12283678::LCT-4921595B:
◆[root@Linserv~]#mount/dev/cdrom/mnt
mount:blockdevice/dev/cdromiswrite-protected,mountingread-only
◆[root@Linserv~]#rpm-ivh/mnt/Server/samba-client-3.0.23c-2.i386.rpm
warning:/mnt/Server/samba-client-3.0.23c-2.i386.rpm:HeaderV3DSAsignature:NOKEY,keyID37017186
Preparing...###########################################[100%]
1:samba-client###########################################[100%]
◆[root@Linserv~]#umount/mnt
◆[root@Linserv~]#mount-ousername=administrator//192.168.0.21/Inetpub/mnt
Password:
◆[root@Linserv~]#ls/mnt
AdminScriptswwwroot
◆[root@Linserv~]#
以上就是RHEL 5 Samba服务器搭建详细过程。完成了windows与RHEL 5系统进行通信,所以RHEL 5 Samba服务器搭建对于RHEL 5来说是十分重要的。