CentOS SAMBA/SQUID Configuration 27th session

Source: Internet
Author: User
Tags ldap

CentOS SAMBA/SQUID Configuration 27th session

The first half of the class

The second half of the class

I. Samba configuration
1. What is Samba
The Samba service is similar to the sharing feature on Windows, which enables you to share files on Linux, access them on Windows, and, of course, access them on Linux.
is a kind of communication protocol that share files and printers on LAN, it provides the sharing service of files and printers among different computers in LAN.

Note: SMB Listening ports: 139 and 445 ports

2. Install the configuration Samba

Yum Install -y Samba samba-client


3, the configuration file explanation:

[Global] Defines the global configuration, workgroup is used to define the workgroup, and I believe that if you install a Windows system, you will be familiar with this workgroup. In general, we need to change the mygroup here to Workgroup (the Windows default workgroup name).
Security = User #这里指定samba的安全等级. There are four types of safety levels:
Share: Users do not need an account and password to log in to the Samba server
User: The Samba server providing the service checks the account and password (default)
Server: Checking account and password work is done by another Windows or Samba server
Domain: Specifies the Windows domain control server to verify the user's account and password.
Passdb backend = Tdbsam # Passdb backend (user backend), Samba has three user backgrounds: smbpasswd (old way), Tdbsam (now commonly used) and Ldapsam.

Both the number and the # sign are the comment characters.


Samba configuration file (/etc/samba/smb.conf)

grep -v  '^#'  |  grep -v  '^; '  | grep ' ^$ '  /etc/samba/smb.conf

Grep-v: Print rows that do not meet the requirements
Print lines that do not start with # and begin with commas

SMBPASSWD: This method uses the SMB tool SMBPASSWD to set up a samba password for the system user (real or virtual), which the client uses to access the Samba resources.
SMBPASSWD in/etc/samba, it is sometimes necessary to create the file manually.
Tdbsam: Create a user database with a database file. The database file is called Passdb.tdb, in/etc/samba.
The PASSDB.TDB user database can use Smbpasswd-a to create Samba users, and Samba users to create must first be system users. You can also use Pdbedit to create a samba account.

Pdbedit a number of parameters, listed several main:
PDBEDIT-A Username: Create a new samba account.
Pdbedit-x Username: Delete Samba account.
Pdbedit-l: Lists the list of Samba users and reads the PASSDB.TDB database file.
PDBEDIT-LV: Lists the Samba user list details.
Pdbedit-c "[D]"-u username: Pauses the Samba user account.
Pdbedit-c "[]"-u username: Restores the samba user account.
Ldapsam: Authenticates the user based on the LDAP account management method. First to establish the LDAP Service, set "Passdb backend = Ldapsam:ldap://ldap Server"

The Load printers and cups options two parameters are used to set up printer-related.


In addition to these parameters, there are several parameters you need to know:
NetBIOS name = MYSERVER # Sets the host name that appears in My Network Places
The hosts allow = 127. 192.168.12.192.168.13. The 172.16.# is used to set the allowed hosts, and if preceded by ";" means all hosts are allowed
Log file =/var/log/samba/%m.log #定义samba的日志, where the%m is the NetBIOS name above
Max log size = 50 # Specifies the maximum capacity of the log, in K
[Homes] This part of the content share the user's own home directory, that is, when the user logged on to the samba server is actually entered into the user's home directory, after the user login, the share name is not homes but the user's own identifier, for a simple file-sharing environment, this part can be looked out.
[Printers] This part of the content set up printer sharing.


4. Samba Practices A
Requires a directory to be shared, accessible by anyone, without entering a password, requiring read-only
[Global] section MyGroup change to Workgroup
Security = user changed to Security = Share
Add at the end:
[Share]
Comment = Share all
Path =/tmp/samba
browseable = yes
Public = yes
writable = no

Mkdir/tmp/samba
chmod 777/tmp/samba
Touch/tmp/samba/sharefiles
echo "111111" >/tmp/samba/sharefiles
Start:/etc/init.d/smb restart
Check that the configured smb.conf are correct testparm
Test: Win Machine Browser input File://192.168.0.22/share
or run column input: \\192.168.0.22

5. Samba Practices Two
Share a directory, log in with a user name and password to access, ask to read and write
The [Global] section reads as follows:

[Global]
Workgroup = Workgroup
Server string = Samba Server Version%v
Security = User
Passdb backend = Tdbsam
Load printers = yes
Cups options = raw

Also need to add:
[MyShare]
Comment = Share for users
Path =/samba
browseable = yes
writable = yes
public = No


Create directory: Mkdir/samba
Modify Permissions: chmod 777/samba

To create a system account:
Useradd user1
Useradd User2
Add User1/user2 as a Samba account:
Pdbedit-a user1
Pdbedit-a User2
List all Samba accounts: pdbedit–l
Restart Service Services SMB restart
Test: Browser Input File://192.168.0.22/myshare


6. Accessing Samba shared files under Linux
Installing the Client Software

Yum Install -y samba-client cifs-utils

Command format: smbclient//ip/share name-u user name
such as: Smbclient//127.0.0.1/share If it is anonymous access can omit-u
Mount Mount Samba Directory

Mount // 192.168.0.22/myshare/mnt-  o  username=user1,password=123456//Security for user username password  Mount//192.168.0.22/myshare/mnt  //security for share sharing Press ENTER directly when entering the password

Enter a question mark to view supported commands

Windows shared folders, Linux mounts

Linux shares a directory, Linux mounts

Samba supports soft link https://fengqi.me/unix/152.html
Samba Chinese garbled problem http://bbs.chinaunix.net/thread-813206-1-1.html
Samba Multi-user Rights Division http://blog.csdn.net/w657395940/article/details/20312053
Samba uses both anonymous and user login Http://shjiayeah.blog.163.com/bl ... 180201321261310349/

F

CentOS SAMBA/SQUID Configuration 27th session

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.