Samba analysis and customization skills

Source: Internet
Author: User
Tags domain server
Article title: Samba analysis and customization skills. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Abstract
This article analyzes Samba services in Linux in detail, including the core, syntax, and group of Samba.
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. Linux system stability and reliability
The majority of users
Welcome. Linux is often effective on small networks or intranets (intranets) such as companies, departments, and organizations.
Strong Files
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.
Network file and
This module processes and uses remote files and resources. By default, Micros on windows workstation
Enable oft client
Use the service Message Block (SMB) protocol. Because of samba, windows and Linux can be integrated and interconnected.
Message.
  
2 Samba core
  
The core of samba is the two daemon processes smbd and nmbd, which run continuously from the server to the stop. Smbd and
Full nmbd usage
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.
Resources and
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
Message header and parameters
It consists of two parts. The message uses the [] sign. the parameter structure is as follows:
Parameter = value.
Parameter can be one or multiple words separated by spaces, and value can be a Boolean value, number, or character.
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, at the end of the line
Suffix
"\", Which can be divided into multiple rows. The line starting with ";" is a changeable configuration. This configuration is used when ";" is removed.
Configuration takes 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 great functions for samba.
Main
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,
You can
The name of the windows domain name or workgroup is given to indicate that samba will be in this domain or
Working group scope
Function.
Server string = samba server indicates that the service information is generally samba server.
Hosts allow indicates the host name List of Linux-samba that can be logged on. the host names are given by IP addresses. Separate multiple IP addresses with spaces.
Open, 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
Configuration information,
In ReaHat linux, the lpd daemon reads the configuration information of the printcap file, and then monitors the printing of the system.
Seek and manage 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
Medium, usually refers
It is set to bsd type.
The guest acount guest account indicates which Linux user is used as the target customer connection. This account has permissions
Very small, root
Users usually set it to nobody.
Security indicates the security mode. Most users use user-level security mode. samba uses a local Unix password file.
Verify. If
When it is set to server, samba will use password server to set the windows NT Domain server authentication method, format
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.
To
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.
Same, 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. From w
Indows access
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.
Data security protection
All.
Writable enables users to read and write files in the main directory when accessing this directory. The value is yes and only read
Permission should be set
Is no.
4.2.2 [printers] Section
The [printers] section is used to specify how to share a Linux network printer and access the Linux Network print from the windwos system.
During server hours, shared applications
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 for those maintenance personnel with read, write, and execution permissions
Users only
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
Start and stop
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. c
Onf is generally located in
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)
  
Related Article

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.