Configure the Samba server in Linux
Configure the Samba server in Linux
1. What is samba?
The Samba service is similar to the sharing Function on windows. It can share files on Linux and access files on windows, but can also be accessed on Linux.
It is a communication protocol for sharing files and printers on the LAN. It provides sharing services for files, printers, and other resources between different computers in the LAN.
2. install and configure samba
Installation command: yum install-y samba-client
Configuration File:/etc/samba/smb. conf
[Global]
Workgroup = MYGROUP
Server string = Samba Server Version % v
Security = user
Passdb backend = tdbsam
Load printers = yes
Cups options = raw
Configuration File explanation:
[Global] defines global configurations. workgroup is used to define working groups. I believe that if you have installed a windows system, you will be familiar with this workgroup. In general, we need to change MYGROUP here to WORKGROUP (the default Working Group name for windows ).
Security = user # specify the samba security level.
There are four security levels:
Share: you can log on to the samba server without your account and password.
User: the samba server that provides services is responsible for checking the account and password (default)
Server: Another windows or samba server is responsible for checking the account and password.
Domain: Specifies the windows domain control server to verify the user's account and password.
Passdb backend = tdbsam # passdb backend (User background)
Samba has three user backgrounds: smbpasswd, tdbsam, and ldapsam.
Load printers: load the printer
Cups options = raw printer settings;
3. samba configuration commands
Smbpasswd: This method uses the smb tool smbpasswd to set a Samba password for system users (real users or virtual users). The client uses this password to access Samba resources. In/etc/samba, smbpasswd sometimes needs to be created manually.
Tdbsam: Creates a user database using a database file. The database file is called passdb. tdb and is in/etc/samba. Passdb. tdb user database can use smbpasswd-a to create a Samba user. The Samba user to be created must first be a system user. You can also use pdbedit to create a Samba account.
There are many pdbedit parameters to list:
Pdbedit-a username: Create a Samba account.
Pdbedit-x username: Delete the Samba account.
Pdbedit-L: List Samba users and read the passdb. tdb database files.
Pdbedit-Lv: list detailed information about Samba users.
Pdbedit-c "[D]"-u username: suspend this Samba user account.
Pdbedit-c "[]"-u username: Restore the Samba user account.
Ldapsam: authenticates users based on LDAP account management. First, you must establish the LDAP service and set "passdb backend = ldapsam: ldap: // LDAP Server"
The load printers and cups options parameters are used to set printer-related parameters.
In addition to these parameters, you need to know the following parameters:
Netbios name = MYSERVER # Set the host name that appears in the network neighbor
Hosts allow = 127. 192.168.12. 192.168.13. 172.16. # is used to set the allowed hosts. If ";" is added in front, all hosts are allowed.
Log file =/var/log/samba/% m. log # defines samba logs. Here % m is the above netbios name
Max log size = 50 # specify the maximum log capacity, in K
[Homes] This part of content shares the user's home directory. That is to say, when a user logs on to the samba server, it actually enters the home directory of the user. After the user logs on, the sharing name is not a homes but an identifier of the user. For a simple file sharing environment, this part can be viewed.
[Printers] This part sets printer sharing.
------------------------------------ Split line ------------------------------------
How to share files with Samba in Ubuntu 14.04
The speed of accessing samba from Ubuntu dual Nic of VMWare Virtual Machine doubles
Add the Samba File Sharing Server to the Windows Server 2003 Domain
Samba installation Configuration
Samba service configuration in CentOS 6.2
Samba Server installation and configuration
How to Build the Win7 + VMware + Fedora18 Samba Server
------------------------------------ Split line ------------------------------------
4. samba Practice 1
To share a directory, anyone can access it, that is, they can access it without entering a password. Read-only is required;
[Global] Change MYGROUP to WORKGROUP
Change security = user to security = share
Add at the end:
[Share]
Comment = share all
Path =/tmp/samba
Browseable = yes
Public = yes
Writable = no
Start the smb service. The ports listened to by smb are 139 and 445;
[Root @ pma ~] #/Etc/init. d/smb start
[Root @ pma ~] # Netstat-nlp | grep smb
Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN 1329/smbd
Tcp 0 0 0.0.0.0: 445 0.0.0.0: * LISTEN 1329/smbd
Tcp 0 0: 139: * LISTEN 1329/smbd
Tcp 0 0: 445: * LISTEN 1329/smbd
Mkdir/tmp/samba
Chmod 777/tmp/samba
Touch/tmp/samba/Upload File
Echo "111111">/tmp/samba/Upload File
Start:/etc/init. d/smb start
Check whether the configured smb. conf is correct. testparm
Test: Enter file: // 192.168.22.30/share in the windows Server Browser.
Or enter \ 192.168.22.30 or \ 192.168.22.30 \ share in the running column.
For more details, please continue to read the highlights on the next page: