Install samba in CentOS and configure anonymous access

Source: Internet
Author: User
1. install the samba service yum-yinstallsmaba in CentOS6.3. edit the samba configuration file vi/etc/samba/smb. confvi/etc/samba/smb. conf1) change user group workgroup & 1. CentOS6.3 install samba service
Yum-y install smaba

2. edit the samba configuration file
Vi/etc/samba/smb. conf
vi /etc/samba/smb.conf

1) change the user group
Workgroup = WORKGROUP
workgroup = WORKGROUP


2) authorized IP addresses
Hosts allow= 127. 192.168.1.
hosts allow = 127. 192.168.1.


3) set the sharing mode
Security = share
security = share


Three sharing methods
Password required in user mode
Share anonymous sharing
Server is more advanced than user-level security
4) set the Access Directory
[Www]

Comment = Document root directory

Path =/var/www/html

Public = yes

Writable = yes

Guest OK = yes // Anonymous access is allowed. If this parameter is not set, anonymous access is not allowed.

[Www] comment = Document root directory path =/var/www/html public = yes writable = yes guest OK = yes // Anonymous access is allowed. If this parameter is not set, anonymous access fails.



3. configure firewall policies
 
  1. Vi/etc/sysconfig/iptables
vi /etc/sysconfig/iptables


1) add the samba Port
 
  1. -A input-m state -- state NEW-m tcp-p tcp -- dport 139-j ACCEPT
  2. -A input-m state -- state NEW-m tcp-p tcp -- dport 445-j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT


2) restart the firewall service
Service iptables restart
service iptables restart



Appendix:
1) view the service port
Netstat-anp | grep smb
  1. [Root @ localhost ~] # Netstat-anp | grep smb
  2. Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN 1874/smbd
  3. Tcp 0 0 0.0.0.0: 445 0.0.0.0: * LISTEN 1874/smbd
  4. Tcp 0 0: 139: * LISTEN 1874/smbd
  5. Tcp 0 0: 445: * LISTEN 1874/smbd
  6. Unix 2 [] DGRAM 12440 1874/smbd
netstat -anp | grep smb[root@localhost ~]# netstat -anp | grep smbtcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      1874/smbd           tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      1874/smbd           tcp        0      0 :::139                      :::*                        LISTEN      1874/smbd           tcp        0      0 :::445                      :::*                        LISTEN      1874/smbd           unix  2      [ ]         DGRAM                    12440  1874/smbd       


2) disable the selinux method
 
  1. [Root @ localhost ~] # Sestatus
  2. SELinux status: enabled
[root@localhost ~]# sestatusSELinux status:                 enabled

[Root @ localhost ~] # Vi/etc/sysconfig/selinux
[root@localhost ~]# vi /etc/sysconfig/selinux

Change SELINUX = disabled
SELINUX = disabled
Restart machine $ reboot
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.