My FAQ,最新最全的IT技术FAQ
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 未整理篇 | 技术讨论
  当前位置: > 操作系统 > Linux > Linux综合
Samba Server
作者:未知 时间:2005-09-13 22:14 出处:Blog.ChinaUnix.net 责编:My FAQ
              摘要:Samba Server

Samba Test between the win2k OS and the virtual pc RedHat9.0 OS

SAMBA TEST

基础知识:

1.一个网卡绑定多个IP地址 :

    linux的网络设备配置文件存放在 : /etc/sysconfig/network-scripts/  目录里面,

对于以太网的第一个网络设备配置文件名一般为ifcfg-eth0.

如果需要为第一个网络设备多绑定一个IP地址,

只需要在/etc/sysconfig/network-scripts/ 目录里面创建一个名为ifcfg-eth0:0的文件,

   内容样例为:

DEVICE     =eth0:0
     IPADDR     =172.16.22.33
     NETMASK  =255.255.0.0
     ONBOOT   =yes


2.samba server have two process :

smbd:

       监听139 TCP端口,处理到来的smb数据包,为使用该软件包的资源与linux进行协商.

nmbd:

监听138 TCP端口,使其他主机或工作站能浏览linux服务器.

 

3.守护进程的启动与终止:

service

     用此命令可以启动或终止守护进程

    命令格式:

       1service   server-name   start/stop/restart

       2cd  /etc/rc.d/init.d

             ./server-name start/stop/restart

 

Samba Server Test  Process:

[test equipment]:

   ①:p4 pc     system : win2K server   and  vmware virtaul pc with the RedHat9.0 OS.

   ②:p4 pc     IP: 168.160.2.53       netmask :255.255.0.0

   ③:virtual pc  IP(eth0):  192.168.193.3    netmask :255.255.255.0  gateway: 192.168.193.2

           virtual interface IP(VMware Network Adapter VMnet8): 192.168.193.1

                                                                                        netmask:255.255.255.0

   ④:virtual pc  connect  with the p4 by the NAT mode.  

   ⑤:host is in the LAN . DNS : 127.0.0.1

   ⑥:Following is the relationship between the p4 and the virtual system :

      

[Process1]Linux system  pc :

 1).linux系统创建用户,

   %useradd username

   %passwd  username                  (create password for the username which be ctreated above)

   %touch  /home/username/testfile (new a file in the username’s home directory )

 2).create a file in the directory    (/etc/samba/)

    %touch  /etc/samba/smbpasswd

    %smbpasswd  -a  username     (add the user to the samba service filesmbpasswd )

3). test itself

    %smbclient  -L ipaddress  -N   (connect to the samba server to check the share content)

    # list the share content.

 

Test1:在linux上建立security=user (见附录A)Samba服务器,win2000访问:

Following the process above , set security=user in the [global] tab of the /etc/samba/smb.conf  file .

    修改[global]段中:
           workgroup = WORKGROUP1

1)Linux -à  windows

 Run the command :

 %smbclient //IPAddr/usernamehomedirectory  -U  username%userpassword

    #Here  disaplay the  smb>    , then you can type help to list all the commands here can be

                                                    used.

 smb>help

 smb>ls     (run ls  usernamehomefile(testfile created above) can be list)

Also

      %smbclient //win2000hostname(IPAddr)/sharefile  -U  loginname%password

          #Here open the win2000  system share file folder

       i.e:可用如下命令在linux下访问window pc

      %smbclient  //IPAddress/share directory -U  win2k当前登陆名%当前登陆名的密码

EXP:%smbclient //168.160.2.53/tool -U  wangleqiu%password (toolwin2k的共享目 ).

 

2)Windows-à linux
        1. Open “network neighbor –> entire network -> all content->microsoft windows network

       ->WORKGROUP1 “

         #Here the linux pc can be found

  2. Input the username and password that was added to the smbpasswd

       file(/etc/samba/smbpasswd) , open the linux pc .

         #Here  we can create a new file ,delete a file here etc.

 

  

 

用户的Home目录共享介绍:

v   [Homes]

   smb.conf文件中一般没有对这个目录的设定特定内容比如路径等。当客户机发出服务请求时,就在smb.conf文件的其它部分查找友特定内容的服务。如果没有发现这些服务,并且提供了homes段时,那么就搜索密码文件得到用户的Home目录。通过 Homes段,Samba可以得到用户的Home目录并使之共享。

[Home]基本参数:

基本参数

         comment 指定对共享的描述

         path 指定共享服务的路径

访问控制参数

      writable 指定共享的路径是否可写

      browseble指定共享的路径是否可浏览

      read onlly指定共享路径是否为只读

      public 指定是否允许guest帐号访问

      valid users 指定允许使用服务的用户列表

      read list设置只读访问用户列表

      write list设置读写访问用户列表

 

Test2:linux上建立security=share (见附录A)Samba服务器,win2000访

Following the process above . Also add the public tab as belows:

 

  [public]
          comment = public
          path = /mnt
          browsable = yes
          public =yes
        

修改[global]段中:
          security = share

 

1),win2k的登陆用户不存在于linux系统中时,在win2k下访问linux需要输入用户名和密码,

2),win2k下建立一个用户,并且该用户也存在于linux中,并用该用户登陆到win2k下,此时,打开

    linux不用属于用户和密码,可以访问此用户的home文件夹,也不用输入用户和密码,但是访问其他

    用户的home文件夹时,需要输入对应用户的用户名和密码。

    允许访问与否与文件夹的属性也有关系。

 

Test3:挂载共享文件夹:

win2k上共享文件夹例如:tools linux下建立文件夹:/mnt/tools  .然后执行以下命令即可在linux系统上挂载win2k文件夹:

 %mount –t smbfs username=fff password=fff //florida/tools  /mnt/tools

其中:username=fff password=fff 是当前登陆到win2k的用户名和密码 . florida win2k pc的计算机名称。

 

 

 

Note: 如果将Homescomment掉,那么当在win2k系统访问linux时,将看不到登陆

用户的home目录.另外当设置Public段时,如果能够允许访问的话,必须是:path

参数指定的文件夹的属性至少是相对于other来说rx.

如果将publiccomment掉,那么在win2k上访问linux时,只能看到登陆用户的

             文件夹,而不能看到其他smb用户的文件夹。

 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 myfaq.com.cn All rights reserved. www.myfaq.com.cn 版权所有