CentOS 6.4_32 bit does not turn off the firewall for samba installation

Source: Internet
Author: User

1 Installation
yum-y Install Samba

2 Modifying a configuration file
Vi/etc/samba/smb.conf
1) Global configuration
[Global]
Workgroup = Workgroup #要访问的电脑的工作组名, Windows generally defaults to this
The hosts allow = 127. 192.168.128. #去掉前面的分号 and modify the network segments that can be accessed (note that the network segment here is the network segment of the virtual machine because the local and virtual machines are networked through NAT)
Security = Share #访问的方式, share no password required, user name and password required

2) The document was last added to the shared directory, and the write operation was allowed
[Public]
Comment = Public Stuff
Path =/home/samba
Public = yes
writable = yes

3 Creating a shared file
Mkdir/home/samba

4 modifying shared file permissions
chmod 777/home/samba

add samba

Use smbpasswd Add Samba user, the user must be Linux The user already exists in the system and the password does not have to be the same as the system user.

If not, add the user first.

#useradd SMB

# smbpasswd    smb   (in windows Access linux required password)
new SMB password: 
Retype New SMB password: 
Failed to find entry for user root. ,
Failed to modify password entry for user root

The reason for the above error is the need for Root the user creates a user, using the Smbpasswd–a Root it can be solved.

description is not available for this user, please use  -A Parameters

options
        -a
           this option specifies that the Username following should is added to the local smbpasswd file, with the new
            password typed (type <Enter> for the old password). This option is ignored if the username following
            already exists in the smbpasswd file and it was treated like a regular change Password command. Note that
           the default Passdb backends require The user to already exist in the system password file (usually
          &NBSP;&NBSP;/ETC/PASSWD), else the request to add the user would fail.

This option was only available when running smbpasswd as root.

Workaround:

Add parameter ' -a ' :

# smbpasswd-a users can, as follows:

 

# smbpasswd-a SMB  
new SMB password: 
Retype new SMB password: 
Added User root. 
( 5 /etc/samba/smb.conf

[Public]

Valid users = SMB (user name)

5 firewall open port (or directly close/etc/init.d/iptables stop)  

1) Open port
Iptables-i input-p UDP--dport 137-j ACCEPT
Iptables-i input-p UDP--dport 138-j ACCEPT
Iptables-i input-p TCP--dport 139-j ACCEPT
Iptables-i input-p TCP--dport 445-j ACCEPT

2) Save configuration
/etc/init.d/iptables Save
3) Restart the firewall
/etc/init.d/iptables restart

SELinux settings

By default, SELinux prohibits the network from writing to the shared directory on the Samba server, even if you allow this operation in smb.conf. Assuming you've configured the shared directory/share and allowed users to read and write, and you don't want to turn selinux off, you can try the following:

Program code:

#/usr/sbin/setsebool-p allow_smbd_anon_write=1 #chcon-T Public_content_rw_t/home/samba

The first statement sets the contents of the public_content_rw_t to be marked by the SELinux release, and the second statement marks the/share directory to be shared as public_content_rw_t. With SELinux information: SELinux profile SELinux provides a flexible, mandatory access control system (MAC) at the Linux kernel level, which is built on a discretionary access control system (DAC).

6 starting Samba services
/ETC/INIT.D/SMB start

7 boot up
Chkconfig SMB on


This article is from the "Passing Cloud" blog, please be sure to keep this source http://272153545.blog.51cto.com/7245562/1606528

CentOS 6.4_32 bit does not turn off the firewall for samba installation

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.