Samba analysis and customization skills

Source: Internet
Author: User
Tags domain server
Abstract This article analyzes the Linux Samba service in detail, including the core, syntax, composition, and
Start and Stop Samba. Several techniques for customizing Samba are also provided.
 
Key words Samba, analysis, customization
 
1 Introduction
 
Linux is an excellent network operating system that can be integrated with multiple networks. The stability and reliability of Linux have been widely used by users.
Welcome, Linux is often used as an effective and powerful file on a small network or on an Intranet (Intranet) such as a company, department, or organization.
And print the server to allow windows clients to share files in Linux. This kind of Linux and windows network integration is through samba
. Samba is a set of software packages that allow Linux to support the SMB protocol. This protocol is implemented by TCP/IP. It is a windows Network File and
This module processes and uses remote files and resources. By default
Use the Service Message Block (SMB) protocol. Because of samba, windows and Linux can be integrated and communicate with each other.
 
2 Samba Core
 
The core of samba is the two daemon processes smbd and nmbd, which run continuously from the server to the stop. Full use of Smbd and nmbd
All configurations are saved in the smb. conf file. Smb. conf describes the output to the smbd and nmbd daemon for sharing,
Share the output to whom and how to output. The role of the Smbd process is to process the incoming SMB software package.
In Linux, The nmbd process allows other hosts (or workstations) to browse Linux servers.
 
3 Samba syntax
 
A complete smb. conf generally consists of Global settings and share Definitions. Each part consists of the message header and parameters.
It consists of two parts. The message uses the [] sign. The parameter structure is as follows:
Parameter = value.
Here, parameter can be one or multiple words separated by spaces, and value can be a Boolean value, number, or string. Parameter notification
The services provided by smba.
In the smb. conf file, the Comment line starts with "#", and each Chinese and English letter is case-insensitive.
"/" To split a row into multiple rows. The line starting with ";" is a configuration that can be changed. When ";" is removed, this configuration will take effect.
 
4 Samba Composition
 
4.1 Global settings (Global parameter settings)
This part is set by the [global] segment. This part provides Global parameters and has a great impact on samba functions.
Used to set the entire system rule. The main parameters of the [global] segment include:
Workgroup = mygroup provides the NT domain name or working group name. mygroup is the name preset by Red Hat6.0.
The name of the domain name or workgroup name that is the same as that of windows to indicate that samba will be in this domain or workgroup.
Function.
Server string = samba server indicates that the service information is generally samba server.
Hosts allow allows you to log on to the Linux-samba host name list, which is provided by IP addresses. Multiple IP addresses are separated by spaces, not in
Hosts in the name list cannot obtain the services provided by samba, which is also an aspect of network security.
Printcap name specifies the printcap file address, usually/etc/printcap, which contains the configuration information of the Linux printer,
In reahat Linux, the LPD daemon reads the configuration information of the printcap file, monitors the printing requests of the system, and manages the printing.
Process.
The default value of load printers is yes.
If the printer used by printing is non-standard, it indicates the printer system type. In Linux
It is set to BSD type.
The Guest acount Guest Account indicates which linux user is used as the target customer connection. Because this account has low permissions, Root
Users usually set it to nobody.
Security indicates the security mode. Most users use user-level security mode, and Samba uses a local UNIX password file for verification. If
When it is set to server, Samba will use password server to set the Windows NT domain server authentication method, in the format of password
Server = NT domain name.
Domain logons provides domain name Logon Service for logging on to Samba from Win95 workstation. Set this item to yes.
Preserve case and short preserve case are different in Chinese and English cases in Linux
In Windows, the original case is kept. Both cases are set to yes.
4.2 share definitions (share definition)
4.2.1 [homes] Section
In the [homes] section, specify the Windows shared home directory. If you log on to the Windows workstation with the same name as the Linux User Name, provide
If the password is the same, open the network neighbor and double-click the shared directory icon to obtain the right to access the directory. Access from windows
In Linux, the user name is used as the shared name of the main directory. The main parameters of the [homes] segment are:
Comment indicates that the service provided is the Home Directories service. The operation is not affected.
Browseable indicates whether other users can browse the user's home directory. Generally, this parameter is set to no to prohibit access by other users to ensure data security.
All.
Writable enables the user to access this directory when reading and writing files in the main directory, the value is yes, only the read permission should be set
Is no.
4.2.2 [printers] Section
[Printers] is used to specify how to share a Linux Network Printer. When a Linux network printer is accessed from the windwos system
Is the Linux printer name specified in printcap. The main parameters in this section include:
If the value of browseable is yes, other users are allowed to access the printer. Otherwise, restrict access to other users.
Printable should be set to yes to print.
When the public parameter is set to no, the customer account is not printed; if the public parameter is set to yes, the customer account is printed.
The writable printer is an output device and cannot be written. It should be set to no.
4.2.3 [tmp] Section
This section provides a temporary sharing method for all users. Main Parameters include:
Path indicates a temporary shared path. It is usually/tmp.
When read-only is set to no, you have read, write, and execution permissions on/tmp.
Public is usually set to yes, so that all users can share the/tmp directory.
4.2.4 [public] Section
This section provides directories accessible to all users. Except that maintenance personnel have read, write, and execution permissions
Has read access permissions. The main parameters include:
Path indicates the public shared directory path, usually/home/samba.
The public value is yes, which allows public sharing. Otherwise, the/home/samba directory cannot be shared by the public.
When the value of writable is yes, the public has write power.
When the value of printable is no, there is no printing power.
Write list refers to a user name list with write power.
4.2.5 [fredsprn] Section
This section is used to specify a dedicated printer.
Comment indicates the printer name.
Valid users is a valid user who uses the printer.
The buffer pool data used by the path dedicated printer is stored in the user's home directory.
Printer indicates the dedicated (private) printer used.
Public: the printer is not shared and only used for private purposes ).
The data in the writable Buffer Pool cannot be written and should be set to No.
Printable indicates whether the printing can be started. The general value is yes.
4.2.6 [fredsdir] Section
This section is used to specify a private directory for the specified user to use. The user has the write permission for this directory.
Comment indicates who the Directory provides services.
Path refers to the private directory path for users to read and write.
Valid users indicates the legal user who uses the private directory.
When the value is no, the private directory is not shared by public users.
Writable indicates that when a user has write permission on the private directory, the value should be yes.
When the value of printable is no, it cannot be printed.
 
5. Start and Stop samba
 
By default, samba in Red Hat Linux is put into operation at startup. You can also use the system script to manually start and stop the instance.
Samba. The specific method is as follows:
#/Etc/rc. d/init. d/smb start (start samba)
#/Etc/rc. d/init. d/smb stop (stop samba)
 
6. samba customization skills
 
By performing vi editing on the smb. conf file, you can add, delete, and modify various services provided by smba. Smb. conf is generally located
It is best to use the/etc directory to customize smb. conf that meets actual requirements.
# Cp/etc/smb. conf/etc/smb. conf. old
Save. To view the content of smb. conf, run the following command:
# Vi/etc/smb. conf
6.1 open Linux File resources to the public. Visitors only have the read permission.
[Public]
Comment = public stuff
Path =/
Public = yes
Writable = no
Printale = no
Write list = @ staff
6.2 shared CD-ROM
Install the optical drive before modifying smb. conf. Run the following command:
# Mount-t iso9660/dev/cdrom/mnt/cdrom
Then customize samba with the following content:
[Cdrom]
Path =/mnt/cdrom
Ready only = yes
Public = yes
6.3 service for multiple users
Comment = userl 'sstuff, user2' sstuff, user3' sstuff
Path =/home/user1 (main directory of user userl)
Valid users = user1 user2 user3
Public = no (except user1, user2, and user3 are not open to public users)
Writable = yes (three users have write permission on files in/home/user1)
Printable = yes (print allowed)
6.4 open/dev directory to public users to view device types.
[Dev]
Comment = open and browse the/dev directory
Path =/dev (path:/dev)
Ready only = yes (read-only)
Public = yes (public sharing)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.