一、端口

Samba服务器所使用的端口:

1.       nmbd-----------------137和138(UDP协议)

2.       smbd-----------------139和445(TCP协议)

二、协议

Smaba服务器所使用的协议:

SMB协议:server message block protocl

三、进程

Samba服务器所使用的两个进程:

Smbd:SMB服务器

Nmbd:netbios名称服务器

四、脚本文件

/etc/rc.d/init.d/smb

Service smb stop/start/restart/reload/status

五、/etc/samba/smb.conf文件说明:

 [全局设置]-------[global]

1. workgroup = WORKGROUP

2. server string = my samba server version %v

3. hosts allow = 192.168.1.  127.  ----------用空格隔开,只书写网络位,允许某网段访问

   (可以全局使用,也可以局部使用;hosts deny = 只能是全局使用)

3.       load printers = yes ---------开机自动加载所有打印机

4.       printcap name = /etc/printcap-----------samba启动时候,自动加载打印机的配置文件

5.       security = user -----------------指定服务器的安全等级或级别

6.       encrypt password = yes/no -----------启用/禁用加密口令

7.       username map = /etc/samba/smbusers-----linux用户映射为windows用户

[局部设置]-----[目录名]----------------在客户端看到的目录名称

1.       comment 是共享目录的描述

2.       path 共享目录绝对路径

3.       public 是否可以匿名访问

4.       writable 设置写权限,配合文件权限使用(设置write list = no)

5.       write list 在这个列表的用户有写权限(设置writable = no )

6.       printables = yes/no 启用/禁用打印机

7.       valid users = 用户 允许访问的用户(设置public = no:不允许匿名访问)

8.       invalid users = 用户 不允许访问的用户

9.       create mode = 640  (可修改) 用户创建文件的默认权限;(图形登录生效,非命令)

10.   directory mode = 750 (可修改) 用户创建目录的默认权限(图形登录生效,非命令)

五、samba服务器的基本指令

1、  smbpasswd指令

这个指令生成samba账户,这个samba账户必须和linux系统的用户账号同名!

-a-------------生成samba账户

-h-------------查看smbpasswd指令的相关用法

2、smbclient指令

  

man手册是这样解释这条指令的:

原文如下:

DESCRIPTION

          This tool is part of the samba(7) suite.

         

          smbclient is a client that can ‘talk’ to an SMB/CIFS servers.It offers

          an interface similar to that of the ftp program (see ftp(1)).

          Operations include things like getting files from the server to the

          Local machine,putting files from the local machine to the server,

          retrieving directory informat from the server and so on.

大意是这样的:

描述

           这个工具是samba(7)镞的一部分

           Smbclient指令作为一个能够与一个协议为SMB/CIFS的服务器进行沟通的客户端,它提供了一个类似于ftp程序(参考ftp(1))的接口,能够进行下载和上传的类似操作。能够从服务器获取目录信息等等

  常用的选项:

         -L  This option allows you to look at what services are available on a server.

            You use it as smbclient –L host and a list should appear.The –I option may be useful if your NETBIOS names don’t match your TCP/IP DNS host names or if you are trying to reach a host on another network.

            这个选项允许你在samba服务器上面看到一些可用的服务项目,使用这样的格式来显示出来:smbclient –L host ,如果你的DNS主机名和你的NETBIOS上面的主机名不相符的时候,或者你想访问另一个网络的一台主机的时候,你可以使用-I 选项,它是有用处的。

 

       -U|--user=username[%password]

          Sets the SMB username or username and password.

          If %password is not specified ,the user will be prompted.The client will first check 

          The USER environment variable, then the LOGNAME varible and if either exists.

          The string is uppercased. If these environmental variables are not found ,the

          Username GUEST is used.

            设置smb的用户名或者用户名和密码

            如果密码没有被指定,则显示密码提示符,客户端将首先检查用户的环境变量和用户的登录名的变量,如果存在且是大写的。如果没有找到环境变量则使用匿名账户登录。

      三种登入samba服务器的格式举例:

       01 、smbclient  //192.168.1.112/homes –U apple%123456----------明文密码

       02、smbclient  //192.168.1.112/homes –user=apple%123456-------明文密码

       03、smbclient  //192.168.1.112/homes –U apple

*******  -----------------提示符下输入密码

2、  smbstatus 指令

显示SMB服务器的的详细连接状态,包括显示客户端的连接的用户、IP地址、主机名称等等。

3、  mount指令

将远程samba服务器上面的共享目录挂载到客户端本地来使用

mount –t cifs //192.168.1.112/sales /mnt –o username=apple%123456—直接输入明码

      mount –t cifs //192.168.1.112/sales /mnt –o username=apple

     :---------------出现密码提示符

     于是将远程目录挂载到了本地目录mnt

4、  testparm指令(参数-v 详细输出)

检查/etc/samba/smb.conf 配置文件的正确性

直接输入指令即可

5、  smbtree指令

man手册页是这样解释这条指令的

NAME

         smbtree  - A text based smb network brower

名字

         smbtree  - 基于文本模式的浏览器

DESCRIPTION

        This tool is part of the samba(7) suite.

        Smbtree is a smb brower program in text mode.It is similar to the

        “Network Neighborhood” found on windows computers. It prints a

        Tree with all the known domains ,the servers in those domais and

        The share on the servers.

 

       大意是这样的:

        描述

              这个工具是samba(7)镞的一个部分

              Smbtree 是在文本模式下的smb浏览器程序,它类似于在windows机器上

              能够找到的“网上邻居”,显示所有已经知道的域名上面的服务项目所共享

              的目录。

 

 ************************samba基本知识篇***********************