redhat enterprise 如何配置samba服务器
发布网友
发布时间:2022-05-02 23:26
我来回答
共1个回答
热心网友
时间:2022-04-12 11:26
/etc/samba/smb.conf主配置文件,此文件中有丰富的说明注释
使用smbpasswd命令使Linux系统用户成为Samba用户,命令格式如下:
smbpasswd –a 用户名
SMB.CONF具体实例
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) 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 a #
# 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 many any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = Workgroup ;计算机所在的工作组名或域名
netbios name = fileserver ;即在,网上邻居中显示的计算机名
# server string is the equivalent of the NT Description field
server string = Samba Server ;计算机描述
This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# 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. ;允许访问的计算机的IP地址
; hosts allow = 172.16.0. 172.16.3. 127.
# if you want to automatically load your printer list rather
# than setting them up indivially then you'll need this
; printcap name = /etc/printcap加载打印机的配置路径
load printers = no是否将打印机共享
# It should 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
; printing = cups一种打印驱动模式,即LINUX支持的标准打印类型。其LINUX支持的打印类型有bsd, sysv, plp, lprng, aix, hpux, qnx
# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = nobody
guest account = guest ;允许访问(不需要用户名与密码)也可以指定任何系统内置的一个帐号做为来宾帐号。
# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/%m.log.会给用户在此目录下做每个SAMBA用户登录的日志。
# Put a capping on the size of the log files (in Kb).
max log size = 50日志 文件*在50K内
# Security mode. Most people will want user level security. See
# security_level.txt for details.
security = share
; security = user
# Use password server option only with security = server
; password server = <NT-Server-Name>此行的作用为如果上面的选项为SERVER,则SAMBA服务器在做身份识别的时候,把WIN机器发过来的密码同用户名交给此项设定的密码服务器验证。
# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
; password level = 8
; username level = 8(对于从前的几款老式的WINDOWS系统对于大小写密码支持的不是很好,所以开启上面的两个参数的意义是在密码为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(加密明文的SAMBA密码进行发送)
smb passwd file = /etc/samba/smbpasswd验证密码所在的目录
# The following are needed to allow password changing from Windows to
# update the Linux sytsem password also.
# NOTE: Use these with 'encrypt passwords' 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.
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
; wins support = yes把该服务器配置为WINS服务器
# 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 = 192.168.1.100也可以指定一个WINS服务器,让自己成为WINS客户
# 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(针对老式计算机,不用设置)
# 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.
dns proxy = no(针对老式计算机,不用设置)
# 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
(整个上面这段为讨论与WINDWOS文件系统的大小写问题因为微软的系统是一个大小写不区分 的系统,默认用默认值即可。因为修改可能造成与WINDOWS的不兼容问题)
#============================ Share Definitions ==============================
[homes]作为登录用户,自己访问自己目录的设置。
; comment = Home Directories目录说明
; browseable = no用户私人目录不需要给别人浏览。
; writable = yes也可以用read only=no来替代
# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]域用户登录目录设置。
; comment = Network Logon Service
; path = /home/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 = /home/profiles
; browseable = no
; guest ok = yes
# NOTE: If you have a BSD-style print system there is no need to
# specifically define each indivial printer
[printers]打印机共享
comment = All Printers说明共享全部打印机
path = /var/spool/samba打印机池,用户必须手工创建该目录。
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = 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, except for people in
# the "staff" group
[public]
comment = Public Stuff
path = /home/soft
public = yes
guest ok = yes以上两个public=yes代表来宾帐号能访问此共享目录,但guest ok代表密码不是必须的,可以不加。
writable = yes
printable = no
write list = @staff此参数告诉我们不必要让所有人访问共享目录,可以有staff这个组的成员能访问,但在passwd和shadow文件中要存在这个组。
# 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 = /homes/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] (为创建一个私有目录,别人都不能访问,只有fred这个用户能访问)
; 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 could
# 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/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 could of course
# be specified, in which case all files would 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 should be writable by both users and should have the
# sticky bit set on it to prevent abuse. Obviously this could be extended to
# as many 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
最后建议在图形界面配置比较简单
在LINUX提示符下输入startx
即可进入图形界面 和WINDOWS差不多 窗口化的配置比较直观也比较简单