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
- Vi/etc/sysconfig/iptables
vi /etc/sysconfig/iptables
1) add the samba Port
- -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
-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
- [Root @ localhost ~] # Netstat-anp | grep smb
- Tcp 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
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
- [Root @ localhost ~] # Sestatus
- 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