So far, the most complete Samba server configuration in Linux

Source: Internet
Author: User
Tags centos server

About Samba, we have no such feeling, got n long ya's alive and dead not panting son. Find all kinds of "elder brother" and "elder sister", found All is "detailed ..." Configuration topic ", see a half a day do not know what to say, finally find a simple tutorial, from start to finish, and then do, a waste of time and energy do not say, is not run up. is not a kind of blood-vomiting physiological reaction. Alas, can't write the document of the doll, hurt Ah. This article realizes the problem of interoperability between Linux and Windows: Set up a samba server under Linux and access it in Windows.

1. Download and install Samba

It is recommended to install with Yum so that it can solve the dependencies of the package itself, saving time, hassle and convenience. A command is done:

yum-y Install samba


2. Configuring Samba

About Samba configuration online data A large number, can follow a lot of tutorials step by step to do to find the last is not used, depressed extremely ah.

My goal is not to be more careful, but to teach you how to samba well, but to teach you how to use samba quickly, so there's not much to consider in terms of security. But in order to take care of people's different levels and tastes, I still write as much as possible.

First of all, I strongly recommend that you modify the original system of any file when you must form "backup first, then modify" The good habit, believe me, this habit will save a lot of time for Lennon do not have to waste. What I want to do next is to dig out the home directory of the user "Koorey" in the/home/directory for me to access under Windows. The steps are as follows:

1). Backup the Samba configuration file:cp/etc/samba/smb.conf/etc/samba/smb.conf.bak

2). Many tutorials on the web say you want to include the following configuration entry in the [Global] field for/etc/samba/smb.conf files:

dos charset = gb2312← Set the text encoding of the Windows client to Simplified Chinese GB2312

UNIX CharSet =gb2312← Specifies the encoding for a new file or directory on the CentOS server where samba is located GB2312

Display charset= gb2312← Specifies the default text encoding for pages when using SWAT (a tool that controls samba through a browser)

Directory mask =0777← Specifies the properties of the new directory (4 lines below)

force Directorymode = 0777

DirectorySecurity mask = 0777

Force directorysecurity mode = 0777

Create Mask =0777← Specify the properties of the new file (4 lines below)

force Createmode = 0777

Security Mask =0777

force SecurityMode = 0777

Disclaimer: I did not add these configurations, and in my shared directory to add, modify delete files are no problem, there is no garbled phenomenon.

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

[Koorey]

Comment = Koorey

Path =/home/koorey

writable = yes

3)./etc/passwd users in Linux have little to do with users in Samba, and it is asserted that all users of samba must be existing users of the system. We want to empower system users to access Samba by command:

smbpasswd-a Koorey #添加用户koorey到Samba用户数据库中

When this command is finished, you are prompted to set the access password for the new user Koorey. Finally , the service SMB Restart command is OK. At this point, the Samba server is ready. Don't believe me? Why? Because there are chapters in the back, haha, that's right. In theory, it's really set up, but don't overlook the existence of Linux security: Iptables and SELinux. In which I ate the selinux a lot of hardship. Because only iptables, but forget the selinux this fork of the guy. About Iptables I will be in the back of the blog from head to toe, from inside to outside, gradually to this and everyone confessed its ins and outs. Of course, if you're interested.

3, in the treatment of iptables problems:

Ordinary youth: knocking directly at the command line ...

service iptables stop.

Literary Youth: Knocking at the command line in turn ...

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, on the issue of SELinux: (This ya's got me in the hole)

Ordinary youth: knocking directly at the command line ...

Setenforce 0

Vi/etc/selinux/config

Changing the selinux=enforcing to Selinux=disabled is no longer performed Setenfore save time after rebooting.

Literary Youth: Knocking at the command line in turn ...

setsebool-psamba_enable_home_dirs on

SETSEBOOL-PSAMBA_EXPORT_ALL_RW on

After the finish:getsebool-a | grep samba , you know ...

5, finally in the Windows system, the results of the visit are as follows:

6, finish the call.

Whether you are an ordinary youth or literary youth, if you are a step by step to do down, the result of the last samba still not pass, please leave a message to tell me.

So far, the most complete Samba server configuration in Linux

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.