Services of samba Service Introduction

A, samba Introduction

1, smb protocol

smb (Server Messages Block, service information block) is a communication protocol for sharing files and printers on the LAN, which provides a shared service resource files and printers among computers with different operating systems on the LAN is. The SMB protocol is a client / server type protocol, clients can access the shared file systems on servers, printers and other resources through the protocol. Figure:

2, cifs protocol

With the popularity of the Internet, Microsoft hopes to extend the SMB protocol up to the Internet, each other become a standard for sharing data between computers on the Internet. So it's hardly any original SMB protocol sort of technical documentation, renamed CIFS (Common Internet File System), which allows the program to access files on a remote computer and Internet requirements for this computer to provide services. Client requests the server program on a server far away for it to provide services. Obtaining request and the server returns a response. CIFS is a public or open SMB protocol version by Microsoft to use. SMB protocol is used for file server on the LAN to access and print protocols.

3, ftp service and samba comparison service
  • ftp advantages and disadvantages:
    Advantages: file transfer, application layer protocol, cross-platform
    Disadvantages: can only file transfer, can not achieve the file system mount; can not modify files directly on the server side
  • Samba features:
    use smb / cifs protocol, cross-platform, enabling file system mount, enabling the server to modify the file

Two, 2. Samba service Detailed

1, Samba software-related information
  • Protocols: SMB / CIFS
  • Software name: smaba
  • Services: smb share resources, rights verification TCP 139 445
  • Configuration file (/ etc / Samba /)
    the smb.conf main configuration file
    smbusers alias profile
2, login authentication mode
  • share anonymous authentication.
  • user local user authentication (Samba server default security level, the user must provide a user name and password before accessing a shared resource for verification).
  • Alias ​​user access (virtual users).
3, the configuration of parameters
[global]#全局配置
        workgroup = SAMBA #设定 Samba Server 所要加入的工作组或者域。 
        security = user #设置用户访问Samba Server的验证方式
        passdb backend = tdbsam #指定数据库文件引擎

        printing = cups  使用 cups服务 进行打印,打印相关配置。
        printcap name = cups
        load printers = yes
        cups options = raw  

[homes]#用户宿主目录配置
        comment = Home Directories #共享描述 
        valid users = %S, %D%w%S  #允许访问该共享的用户
        browseable = No #共享是否可被查看
        read only = No #是否只读
        inherit acls = Yes  #支持acl权限

[printers] #打印相关配置
        comment = All Printers   #打印共享描述
        path = /var/tmp        #打印路径
        printable = Yes        #是否可打印
        create mask = 0600     #创建时文件权限
        browseable = No       #是否可以被浏览

[print$] #打印驱动相关配置
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = @printadmin root
        force group = @printadmin
        create mask = 0664
        directory mask = 0775
                                
4, control write access:
  • Open the configuration file, the file system control strictly (which as far as possible)
    Writable Yes =
    the setfacl or chmod 777
  • File system is turned on, and strictly control the configuration file
    chmod 777 / dir
    the Read only = yes
    the Write List = user, group @
5, start the service and management
1, centos6
启动、停止、重新启动和重新加载Samba服务  service smb start|stop|restart|reload 
开机自动启动samba服务  chkconfig --level 2345  smb on|off 
2、cenos7
启动、停止、重新启动和重新加载Samba服务  systemctl start|stop|restart|reload smb  
开机自动启动samba服务  systemctl  enable/disable smb 
6, client login
Linux 端: 
 smbclient  -U 用户名 -L //服务器 IP     #查看服务器共享 
 smbclient  -U 用户名 //服务器 ip/共享名     #登录服务器共享 
Window 端 
 \\服务器 ip\共享名 
 net  use  *  /del        #清空登录缓存 

Guess you like

Origin www.cnblogs.com/hjnzs/p/12106229.html