Detailed setup of samba server in linux (which can be understood by dummies) 1

Source: Internet
Author: User
Detailed setup of samba server in linux (which can be understood by dummies) 1-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. First, we need to know what samba is designed?
In my opinion, samba has three advantages:
A: It is a file sharing server and a communication channel between linux and windows.
B: It can be used as a print server to provide windows Remote Online printing. (Some people may say that windows can also be used, but I personally think it is still linux stable)
C: samba can also be used as a wins server, and the dhcp server can manage NT domains.
2. At least two service processes (smbd and nmbd) are started at samba each time. What are their respective functions?
Smbd is used to manage what directories and print services are shared by samba hosts.
Nmbd is used to manage groups and resolve netbios names
3. What ports will be used when samba is started?
Samba will use 137,138,139 and three ports at startup, so we will use these three ports When configuring the firewall.
4. How to install samba?
First, we need to check whether we have installed the samba service. Because we installed the samba service by default when installing the system (I installed fedora4 here)
[Root @ www ~] # Rpm-qa | grep samba
Samba-3.0.14a-2
System-config-samba-1.2.31-1
Samba-common-3.0.14a-2
Samba-client-3.0.14a-2
The local machine has been installed. I really recommend that you use the rpmpackage while installing tar.gz. I recommend a website to download all the rpm packages. You only need to install four rpm packages, after the lack of what rpm package directly here to download the www.rpmfind.com, here to remind samba of the latest version of 3.0.28, for the http://us3.samba.com/samba/ftp/
5. Check whether the samba service is started.
[Root @ www ~] # Ps aux | grep samba
Root 32713 0.0 0.0 280 16 pts/0 R + grep samba
6. Start the samba service.
[Root @ www samba] # service smb start
Start the SMB service: [OK]
Start NMB service: [OK]
Start the samba service if you want to start it. There are two methods: a. [root @ www samba] # ntsysv B. [root @ www samba] # chkconfig -- level 345 smb on
7. samba is installed in the etc directory by default. What are the meanings of the files and files in the samba folder?
[Root @ www ~] # Cd/etc/samba/
[Root @ www samba] # ls
Ip address information corresponding to netbios name in lmhosts LAN
Secrets. tdb this is the encrypted Library
Main configuration file of smb. conf samba
Table of user passwords of The smbpasswd samba Server
The Samba service in smbusers user mode must be specified in/etc/samba/smbusers during logon. Only SAMBA users defined in smbusers can log on.
8. smb. conf configuration
A. First, I would like to explain a few important explanations.
Workgroup = MYGROUP workgroup: The same workgroup must exist in the same LAN.
Server string = Samba Server host description. you can name it at will.
Log file =/var/log/samba/% m. log location where the log file is stored
Max log size = 50 max log size here 50 refers to 50 KB
Security = the user must have the user name and password to log on. This is related to smbpasswd.
= Share login without user name and password
= Domin is to make your samba as the master Domain Controller
[Myshare] shared directory
Comment = www.hello521.com description of the shared directory
Path =/var/www/html shared path
Public = no whether to allow all the reporters to see this directory
Read only = no not only readable but also executable access
Whether writable = yes can be written
Whether printable = no can be printed
Valid users = contacts allowed by zy
Create mask = 0765 permission: the directory owner is readable and writable. users in the same group can be read and writable. Other users have only the right to read and execute.
9. Write an instance with security = share
[Root @ www samba] # vi smb. conf
[Global]
Workgroup = MYGROUP
Server string = Zhao Yong Server
Client code page = 950 add this sentence if you want samba to display Chinese characters on windows. The default value is 850.
Security = share: the security level is share.
Log file =/var/log/samba/% m. log location where the log file is stored
Max log size = 0 indicates that the size of the logon file is unlimited.
The following are self-added
[Zy]
Comment = zy samba server
Path =/tmp
Read only = no
Public = yes
Then test the samba server.
[Root @ www samba] # testparm
Then press enter to display all your configurations.
Start samba again
[Root @ www samba] # service smb restart
Client Testing
Open the network neighbor, view all networks, find mygroup, and find your samba host.
10. Next we need to set the samba server that requires password authentication to log on.
[Global]
Workgroup = MYGROUP
Server string = zy Server
Hosts allow = 192.168.1.102 127. Note that the address of my windows host is 192.168.1.102. In this case, only the address 192.168.1.102 is allowed to access the samba server during the security period.
Client code page = 950 add this sentence if you want samba to display Chinese characters on windows. The default value is 850.
Security = the user security level is user
Encrypt passwords = yes use the encrypted password to access samba
Smb passwd file =/etc/samba/smbpasswd password save file path
Log file =/var/log/samba/% m. log location where the log file is stored
Max log size = 0 indicates that the size of the logon file is unlimited.
Set the home directory for each user. Here I have two users zy, yy
[Homes]
Comment = zy yy homes
Browseable = no browseable is yes/no shows the shared directory in the browsing resource. Otherwise, you must specify a shared path to access
Valid users = % s indicates that anyone who can log on. For example, if zy logs on, [homes] is changed to [zy]. in contrast, log on to [homes] With yy to [yy].
Writable = yes writable
Create mask = 0755 The right to create an archive is 755
Directory mask = 0755 the permission to create a directory is 755

[Public]
Comment = zy yy
Path =/home/public specify the path
Public = yes allow public sharing
Writable = yes can be written

11. Create a public directory, create a user, and test the function of restarting the samba server.
[Root @ www home] # mkdir public
[Root @ www ~] # Chmod 777 public permission for this directory
[Root @ www ~] # Useradd yy create system user yy
[Root @ www ~] # Smbpasswd-a yy add yy user to smbpasswd
New SMB password:
Retype new SMB password:
Added user yy.
[Root @ www ~] # Useradd zy
[Root @ www samba] # smbpasswd-a zy
New SMB password:
Retype new SMB password:
Added user zy.
[Root @ www samba] # service smb restart
The test method is the same.
In the next section, we will learn more about configuring the pdc and smb security disk quota for smb.
If you like linux, add group 13275765. Discuss linux together.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.