Article title: full analysis of Samba usage and management Detailed Guide. 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.
The most convenient feature of Windows is the file sharing feature of "network neighbors". with this feature, information transmission and sharing in the local area network can be implemented. In the past, in the Linux World, NFS can be used for file sharing in Unix Like operating systems. However, there is still a lack of communication bridge between NFS and Windows operating environments.
Samba Server establishes a communication channel between Linux and Windows environments. It can also be used as a Print Server to provide Windows remote online printing. if Samba Server is used with Apache Web Server, you can log on to the Linux host using "network neighbor" in a Windows environment to place the user's personal account in the Web Directory (of course, in the local area network). With this function, editing a personal webpage is as convenient as operating on the local machine. In addition, Samba Server can completely replace NT/2000 PDC (Primary Domain Controler) to become the NT/2000 Domain controller managing the NT/2000 Domain fleet. of course, samba can also share directories and files to other Unix Like, Mac, and OS/2 Machines. the application layer is quite broad, what's even more surprising is that Samba Server can also be used as a WINS Server. if it is used with DHCP Server, it can manage large NT/2000 domains. think about it! Does this server, which has many advantages, greatly benefit the integration of operating system environments of different types?
Samba can be positioned as a set of file server software with extremely powerful functions. The so-called file server is to share the directories on the file servo host, this allows you to perform, read, and write operations on files in shared directories through the network. Basically, NT/2000 of domains use NetBEUI for computer naming services, and broadcast packets are used to detect which computers and directories on the network provide resource sharing, the communication between Samba and UNIX hosts (such as directory and file sharing) is achieved through the TCP/IP protocol. if Samba wants to communicate with the NT Domain, of course, TCP/IP does not work, so you have to use NetBIOS to broadcast the NT domain, so that the Windows machine can recognize it and then become a member of the NT Domain; therefore, Samba uses smbd Daemon to contact Unix Like hosts through TCP/IP, while nmbd Daemon is used to contact NT/2000 domains through NetBIOS, that is to say, Samba uses two mechanisms to share resources.
Note: smbd Daemon is mainly used to process file sharing and print sharing services; nmbd Daemon is used to process WINS name resolution services and NT Browser services (that is, network neighbors ).
It is quite easy to use Samba Server. after installing Redhat, you only need to set the working group and activate the Samba Server to operate normally, you can immediately view the name of the Linux host that runs the Samba service in "Network neighbors" in Windows.
Samba-2.0.7-21ssl
Samba-common-2.0.7-21ssl
Samba-client-2.0.7-21ssl (the kits required by samba, please stay Updated !!)
Do you want samba to be automatically activated at startup?
# Chkconfig -- level 345 smb on
Or manually activate
#/Etc/rc. d/init. d/smb start
The above is a simple setting of samba. next we will introduce the setting of samba and other applications.
After the samba suite is installed, you also have the following samba tools:
Smbclient: This tool can be used to connect to other Unix like Samba servers or to Windows machines to obtain the file sharing service.
Testparm: This tool allows you to test whether the smb. conf configuration file is correctly defined.
Testprns: This tool allows you to test the hosts defined in the printcap file.
Smbstatus: This tool can be used to display the online status of client connections to Samba Server.
Nmblookup: This tool can use the host name in the NT/2000 domain to query the corresponding IP address.
Smbpasswd: This tool can be used to create and change the encrypted password used to log on to the Samba server.
Swat: This tool allows you to use web interfaces (such as IE and Netscape) to configure Samba servers.
Are you sure these sentences are not commented out in the/etc/services file?
Netbios-dgm 138/tcp # NETBIOS datemediservice
Netbios-dgm 138/udp
Netbios-ssn 139/tcp # NETBIOS session service
Netbios-ssn139/udp
Then create the/etc/lmhosts File (if it does not exist )? Create a corresponding host. We just need to set up the MS Winndows host? But must the Linux host itself be included as a SAMBA server?
Setting Samba configuration files can be divided into three phases: basic Server settings, user home directory settings, and directory sharing settings. For "shared host settings", you need to set it again when necessary. If it is set in the Samba configuration file/etc/smb. conf, it is for three major projects: [global], [homes], and [shared directory.
Vi/etc/samba/smb. conf
If it is set in the etc/smb. conf file, it is set in the [global] project as follows:
[Global]
Workgroup = MYGROUP; case-insensitive
Unix password sync = Yes
Set the same password for Linux and samba
Domain master = yes
Set samba to a PDC (domain controller). note: This option is not required if Samba is set to an independent server.
Client code pages = 950
If you want to see the Chinese file name? You can add this line to [global] settings.
[Homes]
Browseable = yes
Writable = yes
Public = yes
Write list = @ staff
Samba allows the account owner to read and write the account Directory. if you want some users to write the Directory, enter other user names, such as abc, test, and working, in the write list field of the Users volume.
The user home directory refers to the account directory owned by the individual after logging on to the Samba Server with the user account. for example, after logging on to the Samba Server with the account root, the user's personal directory is/root. Generally, "user home directory settings" focuses on whether to share this personal directory and set access permissions. other projects do not need to be configured.
Note: If you select "Public access" and "Writable", this does not mean that all users have the right to write files in the home directory you shared, you must also set the permissions of the archive in Linux. for example, the Archive permission is rwxr-xr-x (chmod 755), which indicates that only the owner has the write permission. pay attention to this.
[Works]
Comment = share works
Browseable = yes
Path =/works
Public = yes
Writable = yes
Directory sharing settings
The biggest use of Samba is, of course, to share a specific directory. The principle of sharing a directory is nothing more than read and write permissions and sharing objects. by grasping this principle, you can quickly set a shared directory.
Use testparm to test whether the smb. conf syntax is correct, or use smbclient-L (computer_name)
In addition to file Server, Samba can also be used as a WINS Server. The biggest benefit of Wins Server is that it can resolve the Name in the NT/2000 Domain, and traditionally perform FQDN (Full Quality Domain Name) on the Internet) the translation between IP addresses is resolved by DNS, but in the local network, especially the NT/2000 domain, when you use the WINS Server of NT/2000 to match the DNS of NT/2000, assume that there is a host named abc, the domain name is test.com.tw, and the IP address is 192.168.0.229, currently, this host has not been registered on DNS, but the active reverse lookup on DNS can be resolved by WINS. when you use nslookup to query the abc host, you will find that 192.168.0.229 can be parsed, and observe that the DNS is in the checking area, the DNS automatically records abc as A resource and specifies the IP address 192.168.0.229. in the reverse lookup area, the DNS automatically records 229.0. . 168.192.in-addr. arpa indicates abc.test.com.tw, which is the benefit of WINS.
In the past, using DNS + WINS Server in the NT/2000 domain eliminates the need to log on to the host on the DNS. if you use DHCP Server, the IP address of the Client host is also free of input, all dynamic IP addresses are allocated by the DHCP Server, and then the DNS + WINS Server automatically logs on to the relationship between the host FQDN and IP resolution. this is a simple and easy-to-use method to organize domains, it can also be replaced by Samba in DNS + Linux + DHCP in Linux, because Samba can act as the WINS Server or specify the WINS Server for domain name resolution. Assume that the IP address of the Linux host for WINS + DHCP is 192.168.0.229. the setting method is as follows:
First, confirm that the DNS Server has been activated, and enable positive and reverse lookup in the DNS for resolution through WINS.
Set Samba to Wins Server
Wins server = 192.168.0.229
After setting, you can use nmblookup to query the name resolution. assume that the name of a host is abc and the IP address is allocated dynamically. the configured IP address is 192.168.0.100, when you use nmblookup asp for name query, the following screen appears:
[Root @ abc testing] # nmblookup abc
192.168.1.100 abc <00>
Of course, in addition to dynamic IP addresses, DNS + DHCP + WINS can work properly in addition to "network neighbors" and the correspondence between the host FQDN and IP addresses in the region.
In addition to File Server and Wins Server, Samba can also be used as a Printer Server. the setting method is simple:
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.