to enable resource sharing between Windows hosts and Linux servers , the Linux operating system provides samba services, and the Samba service provides a bridge for two different operating systems, enabling communication between Linux and Windows systems, providing great convenience for a wide range of Linux enthusiasts. This article briefly describes how to build a Samba server and simple configuration on a Linux operating system.
1. Service Enquiry
By default, the Linux system already has part of the Samba service pack installed in the default installation, and in order to have a complete understanding of the process, uninstall this section first. using Commands
Rpm-qa | grep samba , you can query to two existing packages by default:
Samba-client-3.0.33-3.7.el5
Samba-common-3.0.33-3.7.el5
2. Uninstalling Samba
Use RPM-E to unload two packages. For Samba-common-3.0.33-3.7.el5, because there is a dependency between the other RPM packages, the parameter-F and--nodeps,-f are mandatory,--nodeps means not checking the dependencies, the complete command is:
rpm-e samba-common-3.0.33-3.7.el5-f--nodeps
RPM-E samba-client-3.0.33-3.7.el5-f--nodeps
3. Install Samba
Install with the following command:
RPM-IVH samba-3.0.33-3.29.el5_6.2.i386.rpm-f--nodeps
RPM-IVH samba-client-3.0.33-3.29.el5_6.2.i386.rpm-f--nodepsRPM-IVH samba-common-3.0.33-3.29.el5_6.2.i386.rpm-f--nodeps
after the installation is complete, use the command Rpm-qa | grep samba make a query and find that all the servers on which the Samba server is built are already installed.
4. Configuring the Smb.conf File
Span style= "font-family: ' Lucida Console '; margin:0px; padding:0px ">samba configuration files are typically placed in the /etc/samba directory, the master profile name is smb.conf A large number of rules and shared information is recorded in the file, so it is a core configuration file that is very important to samba services, and most of the major configurations that complete the Samba server Setup are in this file.
the Samba server works by initiating a request to the Samba server, requesting access to the shared directory, and the Samba server receiving the request, Query the smb.conf file, see if the shared directory exists, and the access rights of the visitor, if the visitor has the appropriate permissions, allow the client access, and finally the system information during the access process and the user Access behavior information collected in the log file.
First Step: Modify the configuration file
First, backup the Samba configuration file
Cd/etc/samba
MV smb.conf smb.conf Bak
Then re-create a smb.conf file
Touch smb.conf
and then we write this into the smb.conf.
[Global]
workgroup = Linuxsir
NetBIOS name = LinuxSir05
Server string = Linux Samba server TestServer
Security = Share
[Linuxsir]
Path =/opt/linuxsir
writeable = yes
browseable = yes
Guest OK = Yes
notes:
[Global] This is a global configuration and must be written in the section. which have the following lines;
workgroup is the workgroup displayed in Windows Here I set the Linuxsir (in uppercase),
NetBIOS name is the computer name displayed in Windows;
server string is the Samba server description that can be defined by itself; this is not important;
security This is the authentication and login method, here we use share; there are many ways to verify this, which is one of Another common use is user authentication, and if you use share, you don't have to set up users and passwords;
[Linuxsir]This is a shared directory that is displayed in Windows;
Path = You can set where the directory you want to share is placed;
whether writeable can be written, here I set as writable;
whether browseable can be browsed, can be browsed means that we can see the shared folder under the workgroup. If you don't want to show it, set it to Browseable=no
Guest OK anonymous user is logged in as guest;
The second step: the establishment of the corresponding directory and authorization;
[email protected] ~]# mkdir-p/opt/linuxsir
[email protected] ~]# ID Nobody
uid=99 (nobody) gid=99 (nobody) groups=99 (nobody)
[email protected] ~]# chown-r Nobody:nobody/opt/linuxsir
notes:
regarding the authorization nobody, we first use the ID command to view the nobody user's information, discovers his user group also nobody, we must take this as the prevail. Some systems nobody user groups are not nobody;
Step three: Start SMBD and NMBD server;
[email protected] ~]# SMBD
[email protected] ~]# nmbd
This third step I did not start the success, so I first set up with NTSYSV to start the automatic loading service, and then immediately restart with Shutdown-r now see the SMB service is running
Reference: http://www.cnblogs.com/whiteyun/archive/2011/05/27/2059670.html