(Original) install Samba in centos Linux

Source: Internet
Author: User

I. Samba Introduction
Samba is a tool suite that implements the SMB (Server Message Block) Protocol on UNIX, or the NetBIOS/LanManager protocol. The SMB protocol is usually used by the Windows series for disk and printer sharing. It should be noted that NetBIOS is based on the Ethernet broadcast mechanism and cannot span network segments without transparent bridges. Maybe wins and LmHosts can be used, but I have not tried it. I feel that samba is implemented by binding SMB to TCP/IP. Samba is only broadcast in the IP subnet (in many cases, I have to specify the IP Address :-(). Therefore, netbeui protocol and TCP/IP protocol must be installed for communication with Samba on Win95.

In the early online world, most of the file data transmitted between different hosts was via FTP, a handy server software. However, there is a small problem when using FTP to transfer files, so you cannot directly modify the file data on the host! That is to say, if you want to change a file on a Linux host, the file must be downloaded to the client by the server before modification. Therefore, the file exists on both the server and client. At this time, if one day you modified a file but forgot to upload the data back to the host, how can you know that the file is the latest after a while?

Since there is such a problem, you can directly access the files on the server on the client side. If you can directly access the files on the server side on the client side, in this case, the archive data does not need to exist on the client, that is, as long as the archive data on the server exists! Is there a file system like this )? Fortunately, networkfile system and NFS are one of these file systems! As long as I mount the shared directory provided by the server on the client side, I can directly access the file data on the server on the client machine, this data is like a partition on the client side! In addition to NFS servers that allow UNIX like machines to share files with each other, Microsoft also has a file system similar to that of commoninternet file system and CIFS! The simplest idea of CIFS is the common "Network neighbors 』. Windows computers can share the file data provided by others through "Network neighbors" on the desktop. However, NFS can only communicate with Unix machines, and CIFS can only communicate with Windows machines. Is there an archive system that allows Windows and Unix-like platforms to share their archive data?

In 1991, a college student named Andrew tridgwell had such troubles. He had three computers running dos PC, Dec Digital UNIX, and Sun UNIX. At that time, Dec developed a software called pathworks, which can be used to share the archive data of the UNIX operating systems of DEC and the DOS Operating Systems of personal computers, unfortunately, tridgwell is troubled by the fact that Sun's Unix cannot use this software to share data. At this time, tridgwell would like to say, "Okay! Since the two systems can communicate with each other, Sun has to be so miserable? Can I find out the operating principles of these two systems and then allow sun to share archive data ?』, To solve this problem, the old man wrote a program to detect the communication protocol information used by DOS and Dec UNIX systems during data sharing and transmission, then extract the important information and develop the file system servermessage Block (SMB) based on the communication protocol found above, this SMB software allows UNIX and DOS to share data with each other! (Note: Once again, the file system that can share file data on UNIX like is NFS, the file system used by the "Network Neighbor" on Windows is called the Common Internet File System, CIFS)

Therefore, tridgwell applied for the smbserver (short for Server Message Block) name as the trademark of the software he wrote. Unfortunately, because SMB is meaningless, therefore, there is no way to achieve registration. In this case, can you find related words in the dictionary and register them as trademarks? It's been around for a long time! This Samba contains SMB and is also the name of a passionate Latin dance. It is better to use this name as a trademark. This becomes the name of samba we are using today.

Ii. System Environment

System Platform: CentO
Firewall disabled/iptables: Firewall is not running.
SELinux = disabled
If SELinux is disabled:
1. Close SELinux quickly and use the following command:

#/Usr/sbin/setenforce 0 Immediately disable SELinux

#/Usr/sbin/setenforce 1 enable SELinux immediately

2. Add it to the default startup of the system.

# Echo "/usr/sbin/setenforce 0">/etc/rc. Local

3. You can edit the configuration file for the same purpose.

# Vi/etc/SELinux/Conf
# Set SELinux = disabled
3. Install samba
1. Use the yum tool for installation on a machine that can be connected to the Internet. if the machine is not connected to the Internet, mount the system disk for installation.

# Yum install samba-client samba-SWAT
2. Check the installation status.
# Rpm-Qa | grep samba
Samba-winbind-3.6.9-151.el6.i686
Samba-winbind-clients-3.6.9-151.el6.i686
Samba-common-3.6.9-151.el6.i686 // mainly provides the setup file and Setup File Syntax validation program testparm for the Samba server
Samba-client-3.6.9-151.el6.i686 // client software, mainly provides Linux host as the client, the required tool instruction set
Samba-swat-3.6.9-151.el6.i686 // https-based Samba Server Web configuration interface
Samba-3.6.9-151.el6.i686 // server software, mainly providing Samba server daemon, sharing documents, log rotation, boot default options

After the Samba server is installed, the configuration file directory/etc/samba and other Samba executable command tools,/etc/samba/smb will be generated. conf is the core configuration file of Samba,/etc/init. d/SMB is the startup/Close file of Samba.
3. Start the Samba server

#/Etc/init. d/SMB start
#/Etc/init. d/nmb start

4. View SAMBA service startup status
# Service SMB status
5. Set auto-start upon startup
# Chkconfig -- level 35 SMB on // automatically runs the samba service at levels 3 and 5
4. Configure samba
1. Create a user group
# Groupadd Test
2. Create a group of users
# Useradd-g test
3. Change the User Password
# Passwd Test
4. Create a folder to be shared under the root directory
# Cd/
# Mkdir share
5. Add the two accounts just created to the samba account.
# Smbpasswd-a test
6. Modify the master configuration file and add the following content to share definitions.
#============================ Share definitions ========== ==================================
[Test]
Comment = test
Path =/share
Writable = Yes
Valid users = @ Test
Write list = @ Test

7. Change the user to which the file belongs.

Chown-HR test/share

8. Restart samba
#/Etc/init. d/SMB restart
#/Etc/init. d/nmb restart

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.