The 64-bit CentOS6.3 system is installed with a minimal package. it is used as a local Web server and the entire process is recorded.
Step 5: install the samba file server to implement the file sharing service of the company
When I installed the centos system, I allocated a partition/file and allocated GB space for file systems. Samba has two processes, smb and nmb. The former is used for file sharing and access through IP addresses, and the latter is the Daemon of the former. it mainly provides computer names other than IP addresses for access and sharing, such as network neighbors
Install samba, check samba installation and install it with yum
[Root @ localhost ~] # Rpm-qa | grep samba
If the installation is complete, it should be shown in
[Root @ localhost ~] # Yum install samba-y
1. installing samba is relatively simple.
2. configure samba. we recommend that you back up the file before modification.
Modify the [global] content and add support for fonts and file attribute settings.
[Global]
Dos charset = GB2312
Unix charset = GB2312
Display charset = GB2312
Directory mask = 0777
Force directories mode = 0777
Directory security mask = 0777
Force directory security mode = 0777
Create mask = 0777
Force create mode = 0777
Security mask = 0777
Force security mode = 0777
Add a shared directory to shield all definitions under the [homes] tag and keep the [public] Directory
[Public
]
Comment = Public Stuff
Path =/file
Public = yes
Writable = yes
Save and exit
3. create a shared directory
Mkdir/srv/sambachown-R nobody./file
Chmod 777/file
4. create a user group named samba. create a user under smaba. use mshare (disable logon) as the user name, define the system user, set the password, and add the user to samba through smbpasswd, two passwords can be set differently.
Groupadd samba
Useradd-G samba mshare-d/file-M-s/sbin/nologin
Smbpasswd-a mshare
5. modify the firewall configuration (skip this step in Ubuntu)
Vi/etc/sysconfig/iptables
Add samba port access permission. Be sure to add it to the end of the ACCEPT line.
-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-p udp-m udp -- dport 137-j ACCEPT
-A input-p udp-m udp -- dport 138-j ACCEPT
Restart iptables
/Etc/rc. d/init. d/iptables restart
6. modify the security attribute of the shared directory. because samba in centos cannot access any folder by default, you must change the security attribute of the folder to obtain the access permission. Otherwise, you cannot access the shared directory (key)
Chcon-R-t samba_share_t/file
7. add samba to the default startup item. the default value is 2-5.
Chkconfig smb on
Chkconfig nmb on
Check opening status
Chkconfig -- list smb
Chkconfig -- list nmb
8. start samba
Service smb start
Service nmb start
Or restart
Service smb restart
Service nmb start