Samba Linux and Windows visits

Source: Internet
Author: User
Tags centos server

Previously used SSHFS manager, but will appear to cause the computer black screen situation. No other similar software was found on the Internet.

Later, I'm going to use Samba to search directly for a very powerful article.

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:

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

Samba Linux and Windows visits

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.