Introduction to Samba server configuration in Linux

Source: Internet
Author: User
Tags centos server

[Switch] Introduction to Samba server configuration in Linux: samba Server Configuration

Link: http://blog.chinaunix.net/uid-23069658-id-3142052.html

Note: samba is mainly used for accessing files between the Internet and ftp over the LAN.

Reprinted content:

It's about Samba. Do you have such a feeling that, after a long time, you can't breathe. Find various "elder brother" and "elder sister" and find that they are all "details... After reading this topic for a long time, I did not know what I was talking about. I finally found a simple tutorial and followed it from start to end. Nima, a waste of time and energy, could not run. Is there a physiological response to vomiting blood. Alas, you can't afford to worry about writing documents. In this article, the problem of resource intercommunication between Linux and Windows is: setting up a Samba server in Linux and accessing it in Windows.

 

1. Download and install Samba

We recommend that you use yum for installation, so that it can solve the package dependency on its own, saving time, saving time and convenience. One command:

Yum-y install samba

 

2. Configure Samba

There is a lot of online information about Samba configuration. You can follow a lot of tutorials to do it step by step and find that it is useless at the end. It is very depressing.

My goal is not to be more careful, but to teach you how to use Samba quickly. Therefore, there are not many security considerations. But in order to take care of the levels and tastes of different grades, I still try to write as many things as possible.

First of all, I strongly recommend that you develop the "Back up first and then modify" habit when modifying any original system files. Believe me, this habit will save you a lot of unnecessary time. Next, I want to dig out the "koorey" home directory under the/home/directory for my access in windows. The procedure is as follows:

1). Back up the Samba configuration file:Cp/etc/samba/smb. conf/etc/samba/smb. conf. bak

2) In many online tutorials, add the following configuration items to the [global] field for the/etc/samba/smb. conf file:

Dos charset = GB2312 character sets the Windows client text encoding to simplified Chinese GB2312

Unix charset = GB2312 bytes indicates that the code for creating a file or directory on the CentOS server where Samba is located is GB2312.

Display charset = GB2312 character specifies the default text encoding of the page when SWAT (a tool that controls Samba through a browser) is used.

Directory mask = 0777 catalog specifies the attributes of the new directory (the following four rows)

Force directorymode = 0777

Directorysecurity mask = 0777

Force directorysecurity mode = 0777

Create mask = 0777 objects specifies the attributes of the new file (the following four rows)

Force createmethod = 0777

Security mask = 0777

Force securitymode = 0777

Disclaimer: I have not added these configurations, and I have added them to the shared directory. There is no problem in modifying and deleting files, and there is no garbled code.

I add the following fields at the end of the/etc/samba/smb. conf file:

[Koorey]

Comment = koorey

Path =/home/koorey

Writable = yes

3 ). in Linux, users in/etc/passwd have almost no relationship with users in Samba. To put it bluntly, all users in Samba must be existing users in the system. To authorize system users to access Samba, run the following command:

Smbpasswd-a koorey# Add a user koorey to the Samba user database

After entering this command, you will be prompted to set an access password for the newly created user koorey. Finally, executeService smb restartThe command is OK. So far, the Samba server has been set up. Believe it? Why? Because there are chapters later, haha, that's right. In theory, we have already set up a security mechanism, so never ignore the existence of Linux security mechanisms: iptables and selinux. I suffered a lot from selinux. Because I only got iptables, but I forgot this guy from selinux. For more information about iptables, I will start from the beginning to the end of my blog, from the inside out to the outside, and explain it to you in a step-by-step manner. Of course, if you are interested.

 

3. iptables:

Normal youth: directly on the command line...

Service iptables stop.

Young literary and artistic talents: in order...

Iptables-I RH-Firewall-1-INPUT 5-m state -- state NEW-m tcp-p tcp -- dport 139-j ACCEPT

Iptables-I RH-Firewall-1-INPUT 5-m state -- state NEW-m tcp-p tcp -- dport 445-j ACCEPT

Iptables-I RH-Firewall-1-INPUT 5-p udp-m udp -- dport 137-j ACCEPT

Iptables-I RH-Firewall-1-INPUT 5-p udp-m udp -- dport 138-j ACCEPT

Iptables-save

Service iptables restart

4. Similarly, in the case of selinux: (this makes me miserable)

Normal youth: directly on the command line...

Setenforce 0

Vi/etc/selinux/config

Change SELINUX = enforcing to SELINUX = disabled, which means that setenfore will not be executed after the instance is restarted to save time.

Young literary and artistic talents: in order...

Setsebool-Psamba_enable_home_dirs on

Setsebool-Psamba_export_all_rw on

After the event is complete, try again:Getsebool-a | grep sambaOne, you know...

5. Finally, in Windows, the access result is as follows:

 

6. Close the job.

Whether you are an ordinary young man or a literary youth, if you follow the instructions step by step, Samba will not work at the end. Leave a message to tell me.

 

Note: either leave a message from the original author or leave a message here.

 

 

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.