How to Learn Samba in LINUX

Source: Internet
Author: User
Tags bit set
How to Learn Samba in LINUX-Linux Enterprise Application-Linux server application information. 1. smb. conf description
---------------------------------------------------------------------
# This is the main Samba configuration file. You shoshould read
# Smb. conf (5) manual page in order to understand the options listed
# Here. Samba has a huge number of retriable options (perhaps too
# Success !) Most of which are not shown in this example
#
# Any line which starts with a; (semi-colon) or a # (hash)
# Is a comment and is ignored. In this example we will use #
# For commentry and a; for parts of the config file that you
# May wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# To check that you have not made any basic syntactic errors.
#
#====================================== Global Settings ==================== ======================================
[Global] describes the overall environment
# Workgroup = NT-Domain-Name or Workgroup-Name
Workgroup = workgroup: Set the name of the workgroup. The name will appear in the network neighbors of Windows and the network servers of Linux.
Netbios name = aaa set netbios bios name
# Server string is the equivalent of the NT Description field
Server string = Samba Server server description
# This option is important for security. It allows you to restrict
# Connections to machines which are on your local network.
# Following example restricts access to two C class networks and
# The "loopback" interface. For more examples of the syntax see
# The smb. conf man page
; Hosts allow = 192.168.1. 192.168.2. 127. It strictly limits the IP address range that can access the Samba Server. By default, all IP addresses are allowed.
# If you want to automatically load your printer list rather
# Than setting them up individually then you'll need this
Printcap name =/etc/printcap printer configuration file path
Load printers = yes whether to share the printer
# It shoshould not be necessary to spell out the print system type unless
# Yours is non-standard. Currently supported print systems include:
# Bsd, sysv, plp, lprng, aix, hpux, qnx, cups
Printing = cups printer type
# Uncomment this if you want a guest account, you must add this to/etc/passwd
# Otherwise the user "nobody" is used
# Guest account = pcguest if you want to remove "pcguest" Anonymous Access #, and ensure that this user exists in/etc/passwd.
# This tells Samba to use a separate log file for each machine
# That connects
Log file =/var/log/samba/% m. log creates different log files for each user logging on to samba in this directory.
# Put a capping on the size of the log files (in Kb ).
Max log size = 0 defines the size of the log file
# Security mode. Most people will want user level security. See
# Security_level.txt for details.
Security = share security Level: share, user, server, and domain
# Use password server option only with security = server
# The argument list may include:
# Password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# Or to auto-locate the domain controller/s
# Password server = *
; Password server =
# Password Level allows matching of _ n _ characters of the password
# All combinations of upper and lower case.
; Password level = 8 password level settings
; Username level = 8
# You may wish to use password encryption. Please read
# ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
# Do not enable this option unless you have read those documents
Encrypt passwords = yes. The user password must be encrypted.
Smb passwd file =/etc/samba/smbpasswd when you set the password Server to Samba server, you need to use this line to specify the password file to be verified. If it is set to window NT Server, this line is not required. The most important here is the path set for the password file.
# The following is needed to keep smbclient from spouting spurous errors
# When Samba is built with support for SSL.
; Ssl CA certFile =/usr/share/ssl/certs/ca-bundle.crt
# The following are needed to allow password changing from Windows
# Update the Linux system password also.
# NOTE: Use these with 'encryption password' and 'smb passwd file' above.
# NOTE2: You do NOT need these to allow workstations to change only
# The encrypted SMB passwords. They allow the Unix password
# To be kept in sync with the SMB password.
Unix password sync = Yes
Passwd program =/usr/bin/passwd % u
Passwd chat = * New * password * % n \ n * Retype * new * password * % n \ n * passwd: * all * authentication * tokens * updated * successfully *
# You can use PAM's password change control flag for Samba. If
# Enabled, then PAM will be used for password changes when requested
# By an SMB client instead of the program listed in passwd program.
# It shoshould be possible to enable this without changing your passwd
# Chat parameter for most setups.
Pam password change = yes when the user asks to change the password, use PAM without the Local password Program/user/bin/passwd
# Unix users can map to different SMB User names
; Username map =/etc/samba/smbusers set the corresponding user in this file
# Using the following line enables you to customise your configuration
# On a per machine basis. The % m gets replaced with the netbios name
# Of the machine that is connecting
; Include =/etc/samba/smb. conf. % m
# This parameter will control whether or not Samba shocould obey PAM's
# Account and session management directives. The default behavior is
# To use PAM for clear text authentication only and to ignore any
# Account or session management. Note that Samba always ignores PAM
# For authentication in the case of encrypt passwords = yes
Obey pam restrictions = yes. When a user authenticates, the user is subject to the PAM management restrictions.
# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
Socket options = TCP_NODELAY SO_RCVBUF = 8192 SO_SNDBUF = 8192
# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# Here. See the man page for details.
; Interfaces = 192.168.12.2/24 192.168.13.2/24 must be listed here if there is a multi-Network Interface
# Configure remote browse list synchronisation here
# Request announcement to, or browse list sync from:
# A specific host or from/to a whole subnet (see below)
; Remote browse sync = 192.168.3.25 192.168.5.255 the row and the next row are remote Browsing settings
# Cause this host to announce itself to local subnets here
; Remote announce = 192.168.1.255 192.168.2.44
# Browser Control Options: Browser Control Options
# Set local master to no if you don't want Samba to become a master
# Browser on your network. Otherwise the normal election rules apply
; Local master = no
# OS Level determines the precedence of this server in master browser
# Elections. The default value shocould be reasonable
; OS level = 33
# Domain Master specifies Samba to be the Domain Master Browser. This
# Allows Samba to collate browse lists between subnets. Don't use this
# If you already have a Windows NT domain controller doing this job
; Domain master = yes
# Preferred Master causes Samba to force a local browser election on startup
# And gives it a slightly higher chance of winning the election
; Preferred master = yes
# Enable this if you want Samba to be a domain logon server
# Windows95 workstations.
; Domain logons = yes
# If you enable domain logons then you may want a per-machine or
# Per user logon script
# Run a specific logon batch file per workstation (machine)
; Logon script = % m. bat
# Run a specific logon batch file per username
; Logon script = % U. bat
# Where to store roving profiles (only for Win95 and WinNT)
# % L substitutes for this servers netbios name, % U is username
# You must uncomment the [Profiles] share below
; Logon path =\\ % L \ Profiles \ % U
# Windows Internet Name Serving Support Section:
# WINS Support-Tells the NMBD component of Samba to enable it's WINS Server
; Wins support = yes
# WINS Server-Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; Wins server = w. x. y. z WINS client settings
# WINS Proxy-Tells Samba to answer name resolution queries on
# Behalf of a non WINS capable client, for this to work there must be
# At least one WINS Server on the network. The default is NO.
; Wins proxy = yes WINS proxy settings
# DNS Proxy-tells Samba whether or not to try to resolve NetBIOS names
# Via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# This has been changed in version 1.9.18 to no.
Username map =/etc/samba/smbusers
Dns proxy = no DNS Proxy settings. By default, DNS queries are not performed for customers.
# Case Preservation can be handy-system default is _ no _
# NOTE: These can be set on a per share basis
; Preserve case = no
; Short preserve case = no
# Default case is normally upper case for all DOS files
; Default case = lower
# Be very careful with case sensitivity-it can break things!
; Case sensitive = no
#============================ Share Definitions ========== ==================================
[Homes] settings for users to access their own directories
Comment = Home Directories description file or directory type
Browseable = yes user private directory, no need to browse for others
Writeable = yes user private directory can be written
Valid users = % S
Create mode = 0664
Directory mode = 0775
# If you want users samba doesn' t recognize to be mapped to a guest user
; Map to guest = bad user

# Un-comment the following and create the netlogon directory for Domain Logons
; [Netlogon] domain user logon directory settings
; Comment = Network Logon Service
; Path =/usr/local/samba/lib/netlogon
; Guest OK = yes
; Writable = no
; Share modes = no

# Un-comment the following to provide a specific roving profile share
# The default is to use the user's home directory
; [Profiles]
; Path =/usr/local/samba/profiles
; Browseable = no
; Guest OK = yes

# NOTE: If you have a BSD-style print system there is no need
# Specifically define each individual printer
[Printers] printer settings
Comment = All Printers indicates that All Printers should be shared.
Path =/var/spool/samba printer. You must create your own directory.
Browseable = no
Printer name = printer
Public = yes indicates sharing
# Set public = yes to allow user 'guest account' to print
Printable = yes
★★The following are my settings★★
[Ftp]
Comment = ftp share sharing description
Path =/var/ftp shared directory
Public = yes indicates sharing
[Cdrom]
Comment = cdrom share
Path =/mnt/cdrom
Public = yes
Root preexec =/bin/mount-t iso9660/dev/cdrom/mnt/cdrom this statement indicates that Samba cdrom is automatically mounted when the user accesses it.
[C]
Comment = c pan
Path =/mnt/c
Public = yes
Root preexec =/bin/mount-t vfat/dev/hdc1/mnt/c when the user accesses the c disk of the windows system that coexist with Samba, it is automatically mounted to/mnt/c
Read only = yes
# This one is useful for people to share files
; [Tmp]
; Comment = Temporary file space
; Path =/tmp
; Read only = no
; Public = yes
# A publicly accessible directory, but read only, cannot t for people in
# The "staff" group
; [Public]
; Comment = Public Stuff
; Path =/home/samba
; Public = yes
; Writable = yes
; Printable = no
; Write list = @ staff
# Other examples.
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# Home directory. Note that fred must have write access to the spool directory,
# Wherever it is.
; [Fredsprn]
; Comment = Fred's Printer
; Valid users = fred
; Path =/home/fred
; Printer = freds_printer
; Public = no
; Writable = no
; Printable = yes
# A private directory, usable only by fred. Note that fred requires write
# Access to the directory.
; [Fredsdir]
; Comment = Fred's Service
; Path =/usr/somewhere/private
; Valid users = fred
; Public = no
; Writable = yes
; Printable = no
# A service which has a different directory for each machine that connects
# This allows you to tailor configurations to incoming machines. You cocould
# Also use the % U option to tailor it by user name.
# The % m gets replaced with the machine name that is connecting.
; [Pchome]
; Comment = PC Directories
; Path =/usr/local/pc/% m
; Public = no
; Writable = yes
# A publicly accessible directory, read/write to all users. Note that all files
# Created in the directory by users will be owned by the default user, so
# Any user with access can delete any other user's files. Obviously this
# Directory must be writable by the default user. Another user cocould of course
# Be specified, in which case all files wocould be owned by that user instead.
; [Public]
; Path =/usr/somewhere/else/public
; Public = yes
; Only guest = yes
; Writable = yes
; Printable = no
# The following two entries demonstrate how to share a directory so that two
# Users can place files there that will be owned by the specific users. In this
# Setup, the directory shocould be writable by both users and shocould have
# Sticky bit set on it to prevent abuse. obviusly this cocould be extended
# As required users as required.
; [Myshare]
; Comment = Mary's and Fred's stuff
; Path =/usr/somewhere/shared
; Valid users = mary fred
; Public = no
; Writable = yes
; Printable = no
; Create mask = 0765
--------------------------------------------------------------------
2. Configure the Samba server
■ 2.1 configure a share-level server
Workgroup = linux
Netbois name = aaa
Printcap name =/etc/printcap
Load printers = yes
Printing = lprng
Guest account = pcguest

Log file =/var/log/samba/% m. log
Max log size = 50
Security = share
Socket options = TCP_NODELAY SO_RCVBUF = 8129 SO_SNDBUF = 9129
[Homes]
Comment = Home Directories
Browseable = yes
Writeable = yes
Valid users = % S
Create mode = 0664
Directory mode = 0775
[Printers]
Comment = All Printers
Path =/var/spool/samba
Browseable = no
Printer name = printer
Public = yes
[Ftp]
Comment = ftp share
Path =/var/ftp
Public = yes
■ 2.2 configure a user-level server

Modify on the basis of share:
Security = share
Change to security = user
Add guest accout = pcguest
Encrypt passwords = yes
Smb passwd file =/etc/samba/smbpasswd
When the configuration file/etc/smb. after setting the user level in conf, you need to set the samba password file and create the smbpasswd account and password so that it is the same as the account and password of/etc/passwd. The method is as follows:
(1) create a local account, generate the password file/etc/passwd, and add all users in/etc/samba/smbpasswd to the file/etc/smbpasswd. Note that this process is to first create an account and password locally, and then
The password file is sent to/etc/samba/smbpasswd. The sequence cannot be reversed, that is, the passwords of local accounts are different from those of samba servers.
# Adduser pcguest
# Passwd pcguest
# Cat/etc/passwd | mksmbpasswd. sh>/etc/samba/smbpasswd
(2) Use the smbpasswd command to set up a samba server password for the account you just created. Note: When you use the smbpasswd command to modify the user password, the local system user account of the modified samba account must already exist.
# Smbpasswd pcguest
(3) restart and support samba server
#/Etc/init. d/smb restart
■ 2.3 configure domain-level servers

You only need to modify the configuration at the user level:
Security = user
Workgroup = linux
Is:
Security = domain
Workgroup = wenda worker wenda is the domain name of the master domain controller.
Add:
Netbios = linux
Password server = wendaserver login uses windows 2000 Master Domain Controller wendaserver as the password server
Comment out:
Smb passwd file =/etc/samba/smbpasswd
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.