CentOS Install Samba
1. Installing Samba
Yum-y Install Samba Samba-client
2. View installation Status
# Rpm-qa | grep Samba
Samba-client-3.0.33-3.40.el5_10
Samba-3.0.33-3.40.el5_10
Samba-common-3.0.33-3.40.el5_10
3. Start Samba
[[Email protected] ~]# service SMB start
Starting SMB services: [OK]
Starting NMB services: [OK]
4. Turn off SELinux and iptables
Start the Samba service directly using service SMB start.
# getenforce command to view selinux status, # Setenforce 0 can temporarily turn off SELinux, change selinux= enforcing to selinux= in/etc/selinux/config Disable can permanently deactivate SELinux
# service Iptables status can view Iptables state, # service Iptables stop can be temporarily closed, # Chkconfig iptables off can permanently shut down the firewall.
The state after the last shutdown should be
Selinux:disabled
Iptables:firewall is not running
These two services must be disabled when not configured, otherwise it will not be accessible!
5. View the startup situation
# Service SMB Status
6. Set up boot from boot
# chkconfig--level SMB on//AT level 3, 5 to automatically run Samba services
7. Check for success:
[[[email protected] share]# chkconfig--list | grep SMB
SMB 0:off 1:off 2:off 3:on 4:off 5:on 6:of F
Results show that the Samba service is automatically running at level 3, 5, the setting is successful
8. Configuration:
[Email protected] ~]# cd/etc/samba/
[email protected] samba]# CP smb.conf smb.conf.bak20160220
[Email protected] samba]# vi/etc/samba/smb.conf
Add or modify the relevant code in the following curly braces in the file:
{
Workgroup = Workgroup//define workgroup, which is the workgroup concept in Windows
Server string = Lmz Samba server Version%v//A brief description of the Samba server definition
NetBIOS name = Lmzsamba//Defines the name of the computer that is displayed in Windows
Define the log file for Samba users,%m on behalf of the client hostname
The Samba server establishes a different log file for each login in the specified directory
Log file =/var/log/samba/log.%m
Security = share//sharing level, users do not need an account and password to access
[Public]//settings for individual settings for shared directories, only for current shared resources
Comment = Public Stuff//description file for the shared directory, you can define the description information
Path =/share//used to specify shared directory, required option
Public = yes//Everyone can view, equivalent to guest OK = yes
}
9. Create a shared directory
Mkdir/share
Cd/share; Touch 1111.txt; Touch 2222.txt; mkdir DD;
Authorizing anonymous users to nobody permissions for the/share directory
Chown-r nobody:nobody/share/
10. Restart the SMB service/ETC/INIT.D/SMB restart
11. Test whether the smb.conf configuration is correct
[Email protected] share]# Testparm
12. Access the shared files of the Samba server:
Test under the CentOS system:
[Email protected] share]# smbclient//127.0.0.1/public
Password:
Domain=[workgroup] Os=[unix] Server=[samba 3.0.33-3.40.el5_10]
Server not using the user level security and no password supplied.
SMB: \> ls
. D 0 Fri Feb 19 17:51:56 2016
.. D 0 Fri Feb 19 17:49:50 2016
1111.txt 5 Fri Feb 19 17:51:10 2016
DD D 0 Fri Feb 19 17:52:12 2016
2222.txt 5 Fri Feb 19 17:51:16 2016
61880 blocks of size 65536. 10157 blocks Available
Testing under Windows:
Enter \\192.168.1.106\public in the browser address bar to see the folders and files under the/share/directory.
or win+r input \\192.168.1.106\public, you can also see the folders and files under the/share/directory.
This article is only the most basic configuration and does not involve security considerations.
For more, refer to:
Installing and configuring Samba http://www.linuxidc.com/Linux/2013-10/90935.htm under CentOS 6.4
Installation and configuration of Samba file server under CentOS http://blog.csdn.net/limingzhong198/article/details/22064801
Configuring the Samba server under CentOS