Install the Samba server in centos5.5 and access the Samba server in windows.

Source: Internet
Author: User
Tags pkill

In Windows, you must have used the sharing function. It is really convenient to directly put the file under the shared directory.

In Linux, how does one implement this sharing function? In fact, sharing is also a communication method. If Windows and Linux communicate with each other, there will be a lot of communications over the Internet, such as the installation version of SSH, which not only facilitates file transfer, you can also create a Linux terminal, remotely operate Linux, and access the IP address of the Samba server in windows. The communication process of Samba is as follows: Install the Samba server in Linux and access the IP address in Windows directly. [Authentication is required. If not required, log on directly.] This blog introduces how to install the Samba server in centos5.5. During the Linux demonstration, I found that all online materials were uninstalled first, because the system is installed by default, but I installed centos5.5 and found a real bare metal. [Xi] Then I will install it step by step based on my own system. First: Install Samba server, need the corresponding software as follows: samba-3.0.33-3.28.el5.i386.rpm samba-client-3.0.33-3.28.el5.i386.rpm samba-common-3.0.33-3.28.el5.i386.rpm Note: if the version is inconsistent, there is no problem, such as your system is 2.7, you only need to use these three software. These three software are all in the CD. I used to copy the file and transfer it to Linux through SSH. Of course, you can use the Mount mode. By default, the CD centos Directory provides many rpm software packages, such as the Chinese font software package mentioned in the previous blog, which can be copied directly from the directory. For convenience, you can download the Samba server software. Note: When installing the first software, always install failed, prompt dependency, you can directly rpm-IVH samba-3.0.33-3.28.el5.i386.rpm-f -- nodeps Second: modify the configuration file SMB. CONF file directory: etc/samba/smb. conf Note: Back up one copy in advance and then replace SMB. delete all conf content as follows:
                [global]                     workgroup = LinuxSir            netbios name = LinuxSir            server string = Linux Samba Server TestServer            security = user         [linuxsir]            path =/test/testSamba/linuxsir                writeable = yes                    browseable = yes           guest ok = no

Note: The [Global] section is a global configuration and is required. There are the following lines: workgroup is the working group displayed in windows; here I set linuxsir (in upper case); NetBIOS name is the computer name displayed in windows; server String is the Samba server description, which can be defined by yourself. This is not important. Security is the authentication and logon method. Here we use share. There are many verification methods, this is one of them; the other is commonly used for user authentication; If share is used, there is no need to set the user and password; [linuxsir] the shared directory is displayed in windows. Path = can be used to set the directory to be shared; writeable can be written, I set it to writable; browseable can be viewed, yes; browsing means that we can see shared folders under the Working Group. If you do not want to display it, set it to browseable = noguest OK. Anonymous Users Log On As guest. Third, create a shared directory and authorize it in step 2, PATH is used to set the shared directory. Therefore, you need to manually create the root @ localhost ~] # Mkdir-P/test/testsamba/linuxsir [root @ localhost ~] # ID nobodyuid = 99 (nobody) gid = 99 (nobody) groups = 99 (nobody) [root @ localhost ~] # Chown-r nobody: Nobody/opt/linuxsir Step 4: Start the Samba server. Samba has two servers: SMB and nmb SMB, which are the main startup servers of Samba, let other machines know what the machine shares. If the nmb server is not enabled, it can only be accessed through IP addresses, for example, in Windows IE browser, enter the following line for access, while nmb is used for resolution. What does it resolve? Resolve the Working Group shared by this Linux machine and the NetBIOS name under this Working Group. To start the server, directly enter two commands. [Root @ bogon ~] # Smbd

[Root @ bogon ~] # Nmbd

Check whether the server is running: [root @ bogon ~] # Pgrep nmbd

5097 [root @ bogon ~] # Pgrep smbd 5094 5095 shut down the server: [root @ bogon linuxsir] # pkill nmbd [root @ bogon linuxsir] # pkill smbd OK, just start the server. Windows. In the Windows running window, enter: directly enter the IP address or host name. Linux automatically displays the shared directory. Note: If the connection fails, check whether the port on the Samba server is tested or blocked due to the firewall when the service is started. Check the Samba server port: [root @ bogon linuxsir] # netstat-tlnp | grep SMB
TCP 0 0 0.0.0.0: 139 0.0.0.0: * Listen 13318/smbd
TCP 0 0 0.0.0.0: 445 0.0.0.0: * Listen 13318/smbd use the Telnet method mentioned in the previous blog to test whether the two ports are tested. If the firewall fails, disable or change the configuration file. [In the previous blog] and because of SMB. the writeable In the conf configuration file is writable, so windows has the write permission. The permission configuration can be configured in this file and then tested using the user method. During connection, create a user name and password: [root @ bogon Samba] # useradd Samba [root @ bogon Samba] # passwd Samba: [root @ bogon Samba] # smbpasswd Samba starts the Samba server, Tests Service SMB start, starts service SMB stop, and stops service SMB restart. It is a little slow to restart the Windows link: then enter the user name and password set in Linux to access.

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.