红帽54搭建samba服务器
㈠ 怎样在linux系统搭建Samba共享服务器
Linux系统默认已经安装了Samba,但是没有安装Samba服务: 1,先查看安装情况:rpm -qa|grep samba 根据系统的安装情况选择下载或者通过光驱安装所缺的rpm包。 我的安装情况是: 使用命令:mount /dev/cdrom1 /mnt/cdrom1 通过mount把cdrom1挂载到系统临时目录/mnt/cdrom1,在Packets包下面使用命令:rpm -ivh samba.*.rpm包安装。 切换到放置rpm文件的目录 [root@smb_server root]# rpm -ivh samba-common-3.6.9-151.el6.x86_64 这是Samba 必备的程序,必须安装 [root@smb_server root]# rpm -ivh samba-3.6.9-151.el6.x86_64 安装Samba 服务器程序,可以使我Windows 主机访问Samba 服务器共享的资源。 如果需要使Linux 主机访问Windows 主机上的共享资源,则还应该安装Samba 客户端程序。 [root@smb_server root]# rpm -ivh samba-client-3.6.9-151.el6.x86_64 2,安装samba的rpm包完成后 samba-common-3.6.9-151.el6.x86_64 //主要提供samba服务器的设置文件与设置文件语法检验程序testparm samba-client-3.6.9-151.el6.x86_64 //客户端软件,主要提供linux主机作为客户端时,所需要的工具指令集 samba-swat-3.6.9-151.el6.x86_64 //基于https协议的samba服务器web配置界面 samba-3.6.9-151.el6.x86_64 //服务器端软件,主要提供samba服务器的守护程序,共享文档,日志的轮替,开机默认选项 Samba服务器安装完毕,会生成配置文件目录/etc/samba和其它一些samba可执行命令工具,/etc/samba/smb.conf是samba的核心配置文件,/etc/init.d/smb是samba的启动/关闭文件。 5、查看samba的服务启动情况 # service smb status 6、设置开机自启动 # chkconfig --level 35 smb on //在3、5级别上自动运行samba服务 7、配置smb服务 [global] workgroup = WORKGROUP server string = Samba Server Version %v netbios name = ImgPath05 [ImgPath] comment = Public stuff path = /usr/local/nginx/html/img public = yes writeable = yes browseable = yes guest ok = yes 共享目录为:/usr/local/nginx/html/img,共享目录对外名称为:ImgPath 即在Windows看到的目录名称。 设置共享目录权限:chown -R nobody:nobody /usr/local/nginx/html/img/ 8、启动或者重启smb服务 重启smb服务 测试smb.conf配置是否正确 9 Windows访问共享目录,但是没有写权限,通过以下方式修改防火墙设置。 将Linux smb服务添加到防火墙的例外中 以root用户执行setup命令#setup弹出...重启生效,如果不想重启,用命令#setenforce 0
㈡ redhat enterprise 如何配置samba服务器
/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差不多 窗口化的配置比较直观也比较简单
㈢ 在红帽企业版5下装samba服务器时出现
yum install samba
用yum,解决依赖问题。
不过,你要可以联网。
㈣ 我在红帽linux5中搭建samba服务器,win7下共享界面却出不来,能教教我吗
1.首先确定samba服务是否运行,smb和nmb两个进程。
2.看一下服务器samba配置文件/etc/samba/smb.conf的workgroup,它必须与Win的工作组一致,一般Win的工作组是WORKGROUP。
3.看配置文件里的interfaces是否正确,hosts allow的ip段是否覆盖Win的ip地址。
4.服务器上启用user安全级别时,是否添加了共享用户,是否允许共享用户浏览。
5.防火墙的规则设置是否正确。
6.SELinux是否阻止你访问samba共享的目录。
㈤ 如何搭建samba服务器
samba安装和启动
samba的源码安装采用最新版本samba-4.1.14,官网下载。安装过程如下:
$ sudo mkdir /usr/local/samba-4.1.14
$ ./configure --prefix=/usr/local/samba-4.1.14
...
Checking for program xsltproc : not found
Checking for program python : /usr/bin/python
Checking for program python : /usr/bin/python
Checking for program python : /usr/bin/python
Checking for Python version >= 2.5.0 : ok 2.7.6
Checking for library python2.7 : not found
Checking for library python2.7 : yes
Checking for program python2.7-config : not found
Checking for program python-config-2.7 : not found
Checking
for custom code
: Could not find the python development headers
/home/anonymalias/Downloads/samba-4.1.14/wscript:100:
error: the configuration failed (see
'/home/anonymalias/Downloads/samba-4.1.14/bin/config.log')
上面错误的原因是samba必须依赖python,执行
$ sudo apt-get install python-dev
后面就是make && sudo make install,安装ok后,安装目录结构如下:
/usr/local/samba-4.1.14$ ls
bin etc include lib private sbin share va
将源码文件下默认的conf文件拷贝到安装目录下的etc目录中
/usr/local/samba-4.1.14$ cp /home/anonymalias/Downloads/samba-4.1.14/examples/smb.conf.default etc/smb.conf
修改smb.conf中配置
global段添加如下字段
[global]
...
netbios name = ubuntu
共享资源字段采用默认配置
[homes]
comment = Home Directories
browseable = no
writable = 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 = /usr/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = yes
添加用户名为Ubuntu的账户,
/usr/local/samba-4.1.14$ sudo bin/smbpasswd -a ubuntu
New SMB password:
Retype new SMB password:
samba服务器的用户是依赖于linux的用户,只能添加linux中已存在的用户,否则会出现如下错误:
/usr/local/samba-4.1.14$ sudo bin/smbpasswd -a user1
New SMB password:
Retype new SMB password:
Failed to add entry for user user1.
启动samba 服务
/usr/local/samba-4.1.14$ sudo sbin/nmbd
/usr/local/samba-4.1.14$ sudo sbin/smbd
在Windwos文件管理器或直接win+R,输入server ip,可以看到如下界面:
㈥ 如何在RedHat中安装samba
为了实现Windows主机与Linux服务器之间的资源共享,Linux操作系统提供了Samba服务,Samba服务为两种不同的操作系统架起了一座桥梁,使Linux系统和Windows系统之间能够实现互相通信,为广泛的Linux爱好者提供了极大方便。本文简要介绍如何在Linux操作系统上搭建Samba服务器和简单配置。
1、服务查询
默认情况下,Linux系统在默认安装中已经安装了Samba服务包的一部分 ,为了对整个过程有一个完整的了解,在此先将这部分卸载掉。使用命令
rpm -qa | grep samba ,默认情况下可以查询到两个已经存在的包:
samba-client-3.0.33-3.7.el5
samba-common-3.0.33-3.7.el5
2、卸载Samba
用rpm -e 将两个包卸载掉。对于samba-common-3.0.33-3.7.el5,因为与其它rpm包之间存在依赖关系,所以必须加参数-f和--nodeps,-f是指强制,--nodeps是指不检查依赖关系,具体完整命令为:
rpm -e samba-common-3.0.33-3.7.el5 -f --nodeps
rpm -e samba-client-3.0.33-3.7.el5 -f --nodeps
3、安装Samba
用以下命令安装:
rpm -ivh samba-3.0.33-3.29.el5_6.2.i386.rpm -f --nodeps
rpm -ivh samba-client-3.0.33-3.29.el5_6.2.i386.rpm -f --nodeps
rpm -ivh samba-common-3.0.33-3.29.el5_6.2.i386.rpm -f --nodeps
安装完成后,使用命令rpm -qa | grep samba进行查询,发现搭建samba服务器所依赖的所有服务器都已经安装好了即可。
4、配置smb.conf文件
Samba的配置文件一般就放在/etc/samba目录中,主配置文件名为smb.conf,文件中记录着大量的规则和共享信息,所以是samba服务非常重要的核心配置文件,完成samba服务器搭建的大部分主要配置都在该文件中进行。
Samba服务器的工作原理是:客户端向Samba服务器发起请求,请求访问共享目录,Samba服务器接收请求,查询smb.conf文件,查看共享目录是否存在,以及来访者的访问权限,如果来访者具有相应的权限,则允许客户端访问,最后将访问过程中系统的信息以及采集的用户访问行为信息存放在日志文件中。
第一步:修改配置文件
首先备份一下samba的配置文件
cd /etc/samba
mv smb.conf smb.confbak
然后重新创建一个smb.conf文件
touch smb.conf
然后我们把这段写入smb.conf中
[global]
workgroup = LinuxSir
netbios name = LinuxSir05
server string = Linux Samba Server TestServer
security = share
[linuxsir]
path = /opt/linuxsir
writeable = yes
browseable = yes
guest ok = yes
注解:
[global]这段是全局配置,是必段写的。其中有如下的几行;
workgroup 就是Windows中显示的工作组;在这里我设置的是LINUXSIR (用大写);
netbios name 就是在Windows中显示出来的计算机名;
server string 就是Samba服务器说明,可以自己来定义;这个不是什么重要的;
security 这是验证和登录方式,这里我们用了share ;验证方式有好多种,这是其中一种;另外一种常用的是user的验证方式;如果用share呢,就是不用设置用户和密码了;
[linuxsir] 这个在Windows中显示出来是共享的目录;
path = 可以设置要共享的目录放在哪里;
writeable 是否可写,这里我设置为可写;
browseable 是否可以浏览,可以;可以浏览意味着,我们在工作组下能看到共享文件夹。如果您不想显示出来,那就设置为 browseable=no
guest ok 匿名用户以guest身份是登录;
第二步:建立相应目录并授权;
[root@localhost ~]# mkdir -p /opt/linuxsir
[root@localhost ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@localhost ~]# chown -R nobody:nobody /opt/linuxsir
注释:
关于授权nobody,我们先用id命令查看了nobody用户的信息,发现他的用户组也是nobody,我们要以这个为准。有些系统nobody用户组并非是nobody ;
第三步:启动smbd和nmbd服务器;
[root@localhost ~]# smbd
[root@localhost ~]# nmbd
㈦ 主机win7,虚拟机里安装的是红帽linux5,怎样在图形界面启动samba服务;
权限在/etc/samba/smb.conf里面配置,比如你共享的文件夹是/home/share,
[home]
path = /home/share
在后面设置权限writeable = yes(写权限)
保存后重启samba,如果还是不行那可能是selinux的问题,你打开smb.conf,在开头注释里面
有这样两行:setsebool -P samba_domain_controller on;setsebool -P samba_enable_home_dirs on,拿到shell里面去执行一下再重启samba 试试
linux查看win7的共享要用smbclient命令,前提是安装了smb客户端
㈧ 如何配置samba服务器
1、安装有关Samba的RPM包(samba、samba-common、samba-client)
2、创建Samba用户
3、修改配置文件
4、重启samba服务
5、设置目录访问权限
6、测试
具体步骤如下:
1、安装RPM包(缺省情况下RHEL5安装了samba的相关软件包,可以用如下命令查看)
[root@localhost ~]#rpm -qa | grep samba
samba -----samba服务器程序的所有文件
samba-common -----提供了Samba服务器和客户机中都必须使用的公共文件
samba-client -----提供了Samba客户机的所有文件
samba-swat -----以Web界面的形式提供了对Samba服务器的管理功能
2、创建samba用户
[root@localhost ~]#smbpasswd -a user1 (“-a”是创建samba用户,“-x”是删 [root@localhost ~]#smbpasswd -a user2 除samba用户,“-d”是禁用samba用
[root@localhost ~]#smbpasswd -a user3 户帐号,“-e”是启用samba用户帐号)
3、修改配置文件
samba配置文件的位置:/etc/samba/smb.conf
[root@localhost ~]#vim /etc/samba/smb.conf
Vi大开配置文件后,首先介绍一下Samba服务器的安全级别,如图所示:系统默认设置“user”
Samba服务器的安全级别分为5种,分别是user、share、server、domain和ads。在设置不同的级别时,samba服务器还会使用口令服务器和加密口令。
1、user -----客户端访问服务器时需要输入用户名和密码,通过验证后,才能使用服务器的共享资源。此级别使用加密的方式传送密码。
2、share -----客户端连接服务器时不需要输入用户名和密码
3、server -----客户端在访问时同样需要输入用户名和密码,但是,密码验证需要密码验证服务器来负责。
4、domain -----采用域控制器对用户进行身份验证
5、ads -----若samba服务器加入到Windows活动目录中,则使用ads安全级别,ads安全级别也必须指定口令服务器
共享目录的配置
[homes] -----samba用户的宿主目录
comment = Home Directories -----设置共享的说明信息
browseable = no -----目录浏览权限
writable = yes -----用户对共享目录可写
这个共享目录只有用户本身可以使用,默认情况下,用户主目录位于/home目录下,每个Linux用户有一个以用户名命名的子目录。
以下是共享打印机的设置:
[printers] -----共享打印机
comment = All Printers -----设置共享的说明信息
path = /var/spool/samba -----指定共享目录的路径
browseable = no -----目录浏览权限
guest ok = no -----允许来宾访问
writable = no -----用户对共享目录可写
printable = yes -----可以打印
以上是系统默认设置
添加自定义的共享目录:( user1对/ASUS有所有权,user2拥有只读权限,其他用户不能访问;public共享目录允许所有用户访问及上传文件)
[ASUS]
comment = user1 Directories -----设置共享的说明信息
browseable = yes -----所有samba用户都可以看到该目录
writable = yes -----用户对共享目录可写
path = /ASUS -----指定共享目录的路径
[public]
comment = all user Directories -----设置共享的说明信息
browseable = yes -----所有samba用户都可以看到该目录
writable = yes -----用户对共享目录可写
path = /public -----指定共享目录的路径
guest ok = yes -----允许来宾访问
4、修改完配置文件后需要重启samba服务
[root@localhost ~]#service smb restart
Samba服务器包括两个服务程序
2 smbd
? smbd服务程序为客户机提供了服务器中共享资源的访问
2 nmbd
? nmbd服务程序提供了NetBIOS主机名称的解析,为Windows网络中域或者工作组内的主机进行主机名称的解析
5、设置目录权限
[root@localhost ~]#mkdir /ASUS ------创建要共享目录
[root@localhost ~]#mkdir /public ------创建要共享的目录
[root@localhost ~]#chmod 750 /ASUS ------修改/ASUS权限(属主拥有
所有权,属组只读,其它用户不能访问)
[root@localhost ~]#chown user1 /ASUS ------将/ASUS的属主改为user1
[root@localhost ~]#groupadd ASUS ------添加ASUS组
[root@localhost ~]#usermod –G ASUS user1 ------将user1加入到ASUS组
[root@localhost ~]#usermod –G ASUS user2 ------将user2加入到ASUS组
[root@localhost ~]#chgrp ASUS /ASUS ------将/ASUS的属组改为
ASUS
[root@localhost ~]#chmod 777 /public ------给所有用户分配完全控制
权限
配置完成后,还要检查/etc/service文件中以“netbios”开头的记录,正确的文件
记录如下所示,如果这些记录前有#或没有这些记录,应手工添加,否则用户无
法访问Linux服务器上的共享资源
6、测试
找一台内网windows客户端,打开“网上邻居 ”,输入samba服务器的IP点击
“搜索”
如图所示:已经搜索到
双击打开,如图所示:提示输入用户名和密码,先来输入user1的用户名和密码
作测试。
登录成功,
打开user1的宿主目录,此目录user1是拥有所有权限的,创建一个目录测试一
下,如图所示:可以创建
Public目录是允许任何用户上传、下载及删除文件,如图所示
User1对ASUS目录拥有完全控制权限,所以user1可以在此目录下作任何操作
切换另一个用户测试,由于我们在同一台计算机上作测试,测试之前首先要清楚
计算机上的缓存,如图所示:打开 “命令提示符模式”,“net use /del *”是清
除计算机上缓存
重新打开网上邻居,找到Samba 服务器的共享资源,以user2的身份登录
以下几幅图片可以看到,user2对ASUS目录拥有只读权限,对public、user2目
录拥有所有权
再切换一个用户登录,记得要清除缓存哦,输入user3的用户名及密码
如图所示:user3无法访问ASUS目录
User3只对user3和public目录拥有所有权
㈨ 搭建samba服务器应该注意什么
一般你装系统的时候会默认安装samba,如果没有安装,只需要运行这个命令安装(CentOS):
“yum install -y samba samba-client”
Samba的配置文件为/etc/samba/smb.conf,通过修改这个配置文件来完成我们的各种需求。打开这个配置文件,你会发现很多内容都用”#”或者”;”注视掉了。先看一下未被注释掉的部分:
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
主要有以上三个部分:[global], [homes], [printers]。
[global]定义全局的配置,”workgroup”用来定义工作组,相信如果你安装过windows的系统,你会对这个workgroup不陌生。一般情况下,需要我们把这里的”MYGROUP”改成”WORKGROUP”(windows默认的工作组名字)。
security = user #这里指定samba的安全等级。关于安全等级有四种:
share:用户不需要账户及密码即可登录samba服务器
user:由提供服务的samba服务器负责检查账户及密码(默认)
server:检查账户及密码的工作由另一台windows或samba服务器负责
domain:指定windows域控制服务器来验证用户的账户及密码。
passdb backend = tdbsam # passdb backend (用户后台),samba有三种用户后台:smbpasswd, tdbsam和ldapsam.
smbpasswd:该方式是使用smb工具smbpasswd给系统用户(真实用户或者虚拟用户)设置一个Samba 密码,客户端就用此密码访问Samba资源。smbpasswd在/etc/samba中,有时需要手工创建该文件。
tdbsam:使用数据库文件创建用户数据库。数据库文件叫passdb.tdb,在/etc/samba中。passdb.tdb用户数据库可使用smbpasswd –a创建Samba用户,要创建的Samba用户必须先是系统用户。也可使用pdbedit创建Samba账户。pdbedit参数很多,列出几个主要的:
pdbedit –a username:新建Samba账户。
pdbedit –x username:删除Samba账户。
pdbedit –L:列出Samba用户列表,读取passdb.tdb数据库文件。
pdbedit –Lv:列出Samba用户列表详细信息。
pdbedit –c “[D]”–u username:暂停该Samba用户账号。
pdbedit –c “[]”–u username:恢复该Samba用户账号。
ldapsam:基于LDAP账户管理方式验证用户。首先要建立LDAP服务,设置“passdb backend = ldapsam:ldap://LDAP Server”
load printers 和 cups options 两个参数用来设置打印机相关。
除了这些参数外,还有几个参数需要你了解:
netbios name = MYSERVER # 设置出现在“网上邻居”中的主机名
hosts allow = 127. 192.168.12. 192.168.13. # 用来设置允许的主机,如果在前面加”;”则表示允许所有主机
log file = /var/log/samba/%m.log #定义samba的日志,这里的%m是上面的netbios name
max log size = 50 # 指定日志的最大容量,单位是K
[homes]该部分内容共享用户自己的家目录,也就是说,当用户登录到samba服务器上时实际上是进入到了该用户的家目录,用户登陆后,共享名不是homes而是用户自己的标识符,对于单纯的文件共享的环境来说,这部分可以注视掉。
[printers]该部分内容设置打印机共享。
㈩ 在红帽linux5中搭建samba服务器,在win7下共享界面也出来了,但访问不了
使用虚拟机的吧?
你有给share这个目录权限吗?没有的话就在linux下输入命令:chmod 777 share;
如果还解决不了,应该就是samba的配置文件没配置好,在smb.conf里,要配置好访问的用户或用户组,还要设置相应的权限,如writable,read only 之类的权限。