Install samba in CentOS and configure Anonymous Access

Source: Internet
Author: User

1. Install the samba service in CentOS6.3
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
Hostsallow = 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 = Documentrootdirectory

Path =/var/www/html

Public = yes

Writable = yes

Guestok = 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. -AINPUT-mstate -- stateNEW-mtcp-ptcp -- dport139-jACCEPT
  2. -AINPUT-mstate -- stateNEW-mtcp-ptcp -- dport445-jACCEPT
-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
Serviceiptablesrestart
service iptables restart



Appendix:
1) view the service port
Netstat-anp | grepsmb
  1. [Root @ localhost ~] # Netstat-anp | grepsmb
  2. Tcp000.0.0.0: 1390.0.0.0: * LISTEN1874/smbd
  3. Tcp000.0.0.0: 4450.0.0.0: * LISTEN1874/smbd
  4. Tcp00: 139: * LISTEN1874/smbd
  5. Tcp00: 445: * LISTEN1874/smbd
  6. Unix2 [] dgram123161874/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. SELinuxstatus: 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

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.