In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
12.1. Introduction to Samba
Linux and Windows are two operating systems that are completely different in style and technology. They are two opposing formations. Each has its own user base and market. However, to achieve resource sharing between the two systems, you need to use Samba. Samba adopts Cramp S working mode, through which a host of Linux system can be configured as a Samba server, while other computers that install and use SMB protocol can share files and printers with Linux through Samba services.
The Samba service can be installed through the yum command or through the source code. In order to obtain the latest version of the Samba software, you can download the source code installation package of the software from its official website https://www.samba.org/.
[root@localhost home] # wget https://download.samba.org/pub/samba/stable/samba-4.6.5.tar.gz [root@localhost home] # tar xf samba-4.6.5.tar.gz [root@localhost home] # cd samba-4.6.5 [root@localhost samba-4.6.5] #. / configure [root@localhost samba-4.6.5] # make & & make install [root@localhost samba-4.6.5] # cp / Home/samba-4.6.5/packaging/LSB/smb.conf / usr/local/samba/etc/ # copy configuration file [root@localhost samba-4.6.5] # echo'/ usr/local/samba/lib' > > / etc/ld.so.conf [root@localhost samba-4.6.5] # ldconfig # add library files to the system [root@localhost samba-4.6.5] # grep 'netbios' / etc/services # make sure this is in the file netbios-ns 137/tcp # NETBIOS Name Servicenetbios-ns 137/udpnetbios-dgm 138/tcp # NETBIOS Datagram Servicenetbios-dgm 138/udpnetbios-ssn 139/tcp # NETBIOS session servicenetbios-ssn 139/udp
Start and shut down Samba
The Samba server includes two processes, smbd and nmbd, which are the daemons of Samba's SMB (Service Message Block) service and the NetBIOS service daemons, respectively. For the Samba server to function properly, you must start both processes at the same time, which serve the following purposes:
The daemon of the nmbd:NetBIOS name service can help clients locate servers and domains, which is equivalent to the WINS server in Windows NT.
[root@localhost sbin] # / usr/local/samba/sbin/nmbd-D # start root [root @ localhost sbin] # / usr/local/samba/sbin/smbd-D [root@localhost samba] # ps-ef | grep nmbd # check whether the process starts Samba 35891 10 18:02? 00:00:00 / usr/local/samba/sbin/nmbd-Droot 35899 1305 0 18:02 pts/0 00: 00:00 grep nmbd [root@localhost samba] # ps-ef | grep smbdroot 35893 1 0 18:02? 00:00:00 / usr/local/samba/sbin/smbd-Droot 35894 35893 0 18:02? 00:00:00 / usr/local/samba/sbin/smbd-Droot 35895 35893 0 18:02? 00:00:00 / usr/local/samba/sbin/smbd-Droot 35897 35893 0 18:02? 00:00:00 / usr/local/samba/sbin/smbd-Droot 35901 1305 0 18:02 pts/0 00:00:00 grep smbd
12.2. Basic configuration of Samba server
The configuration changes of Samba are mainly accomplished by modifying its main configuration file, smb.conf, which consists of global settings and share definitions. The changes to the file will not take effect immediately. Users need to restart the Samba server or execute the corresponding command to reload the configuration file to make it effective.
Smb.conf profile
Smb.conf is the main configuration file for Samba, including global settings and share definitions. The global settings define the global options that affect the operation of the entire Samba system, which are used to set the rules of the entire system; the sharing definition defines the shared resources in the system, which can be composed of multiple segments, including: user home directory segment, shared directory segment and print segment, and detailed sharing options can be defined in each segment.
Global setting option
The option name indicates that netbios name sets the NetBIOS name. By default, the server hostname workgroup sets the workgroup name server string to which the Samba server belongs.
Set the description information for the samba server
Interfaces
Bind interfaces only
If the server has multiple IP addresses, you can use the interfaces option to list the IP addresses. If bind interfaces only is set to yes, it means
Samba will bind the IP address set by the interfaces option
Hosts allow
Hosts deny
Hosts allow specifies the list of clients allowed to access the Samba server
Hosts deny specifies access denied client list
Printcap
Set the printer profile load printers used in the [printers] section
When enabled, all printer printing in the profile specified by printcap name will be automatically shared.
Set the type of printer guest account
Specify the guest account used in samba. Default nobodywins server
Sets whether the samba server is the wins proxy of the wins server
Sets whether to enable WINS proxy feature dns proxy sets whether DNS proxy feature username map is enabled
Sharing option
Shared directory, in which you specify a directory that is shared through samba, and define various settings for the shared directory. To pass through the directory / home/samba on the Samba shared server, the share name is share, and users can only read and not write to the directory.
[share] # share name of the shared directory comment = For testing only # description of the shared directory path = / home/samba # specify the shared directory read only = yes # the shared directory is read-only
[home] comment = Home Directories # comment information browseable = no # not browsable writable = yes # writable valid users = mary fred # list of valid users create mode = 0664 # permission mode directory mode = 0775 # directory mode
Printers and shared printers are common applications of Samba servers. Using Samba to share printers can effectively save hardware resources.
Printcap name = / etc/printcap # specify printer configuration file location in the system load printers = yes # specify automatic sharing / etc/printcap file set printer printing = cups # specify emergency type [printers] comment = All Printers # comment information path = / var/spool/samba # specify printer pool browseable = no # not allowed Browse public = yes # to specify that the guest account is allowed to use the printer printable = yes # to allow printing using this printer
Samba user Management
The user of Samba is associated with the operating system user. Before creating the Samba user, you must add an operating system user with the same name, but the passwords of the two can be different. Samba users are managed through the smbpasswd command, which is in the following format:
Smbpasswd [options] [username]
Common options:
-h: displays command help information
-a: add users
-d: disable a user
-e: enable a user
-n: set the user password to empty
User mapping, in order to prevent Samba users from guessing operating system user information through Samba accounts and to provide flexible user management methods, there is Samba user mapping, and the mapped accounts do not need to be created. The method of implementing user mapping:
1. Edit smb.conf to add a user mapping file in the [global] section
Username map = / etc/samba/smbusers
2. Manually create the user mapping file / etc/samba/smbusers, which is in the following format:
# Samba user account = list of accounts to be mapped root = administrator adminnobody = guestshare = jim jack
3. Restart the samba server
12.3. Log settings
The log of Samba is stored in the'/ var/' directory by default, where the smbd process log is log.smbd,nmbd process log and log.nmbd. Users can also set the logging options provided by Samba. You can set the location and format of the log in the smb.conf configuration file:
Log file = / var/log/samba/log.%m
Where% m is the Samba profile retention variable, which represents the NetBIOS of the client. The common retention variables are:
% a
Client schema d process number D of the current server process
User's win domain G
Primary user group H of the logged in user
User's home directory h
Hostname of the Samba server I
IP address of the client j
Print the task number of the task% L
NetBIOS name of the Samba server M
Host name of the client m
Client's NetBIOS name p printed file name S
Name of the current share% T
Current date and time v
Samba version number $name
Variables of the environment variable name
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.