发新话题
打印

[samba] Samba服务配置与应用案例

Samba服务配置与应用案例

Samba服务配置与应用案例
                          Author:NetSeek    From:http://www.ourforge.net

一,Samba的简单介绍
1.Samba的作用:
它能够使windows用户通过“网上邻居”,等熟悉的方式直接访问Linux上的资源,也能使linux利用SMB客户端程序访问Windows的共享资源。

2.SMB协议简介:
SMB(Server Message Block,服务信息块),看作是局域网上的共享文件夹/打印机的一种协议.

3.Samba服务的简介:
Samba属于GNU Public License (GPL)软件,任何用户都可以合法且免费的使用他可以到其官方网站http://www.samba.org 下载.

Samba的主要功能:
1,提供windows风格的文件和打印机共享。
2,在Windows网络中解析NetBios的名字
3,提供SMB客户端,linux用户可以利用smbclient利用类似于ftp的形式访问windows资源.
4, 提供命令行工具,利用该工具可以有限制地支持windows的某些管理功能.

二,Samba的安装

1.Samba服务的安装:
[root@www ~]# rpm -qa |grep samba   //查看是否安装软件,我已经安装好啦.
复制内容到剪贴板
代码:
samba-common-3.0.10-1.4E.2
samba-client-3.0.10-1.4E.2
system-config-samba-1.2.21-1
samba-3.0.10-1.4E.2
2.rpm -ivh ....//如果没有安装将以上套件包安装上.

三,Samba服务配置

1.查看共享服务需要打开的端口
[root@www ~]# cat /etc/services | grep netbios
复制内容到剪贴板
代码:

netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp
netbios-dgm     138/tcp                         # NETBIOS Datagram Service
netbios-dgm     138/udp
netbios-ssn     139/tcp                         # NETBIOS session service
netbios-ssn     139/udp
注:这几个服务需要打开,否则用户将无法访问linux服务器上的共享资源,还要注意防火墙的是否允许Windows访问linux资源.

2.配置文件详细介绍:
#grep -v  '^#' /etc/samba/smb.conf  | grep -v '^$'|grep -v '^;'    //忽略注释配置samba文件
复制内容到剪贴板
代码:

[global]
   workgroup = WORKGROUP
   server string = Samba Server
   printcap name = /etc/printcap
   load printers = yes
cups options = raw
log file = /var/log/samba/%m.log
   max log size = 50
   security = user
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
   dns proxy = no
   idmap uid = 16777216-33554431
   idmap gid = 16777216-33554431
   template shell = /bin/false
   winbind use default domain = no
[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

          可以看到Samba的配置文件分为三段.
          [global] :这个小节主要包含全局参数.
       [homes]  :这个小节用于共享存储在\home中的Linux用户目录
       [printers] :用于共享本地linux打印机文件/etc/printcap中列出的所有打印机.

[global]  全局参数配置
      
复制内容到剪贴板
代码:
workgroup = WORKGROUP
       netbios = dolinux.cn
       server string = NetSeek's Samba Server(%h Samba Server)
       hosts allow = netseek,cnseek.org,192.168.0. EXPECT 192.168.0.5
          //允许主机名为netseek的客户端访问,允许域为cnseek.org的域访问,允许192.168.0.*所有的

主机均可访问,
       除了192.168.0.5之外.
      printcap name = /etc/printcap  //Samba启动是,将自动加载的打印机配置文件,建议默认即可.
      load printers = yes            //允许自动加载浏览列表,默认即可.
      
       log file = /var/log/samba/%m.log  samba相关的日志文件.
关于变量介绍:#man 5 smb.conf 后搜索%后可以看到很多参数介绍:
变量       说明      
客户端变量   
%a   客户端体系:
比如: Win98, WinNT, Samba ...   
%I   客户端IP地址      
%m 客户端NetBios名  
%M 客户端DNS名      
用户变量      
%g  用户%u 主要组   
%H  用户%u home 目录      
%u  Unix 当前用户名  
共享变量      
%P  当前共享的根目录      
%S  当前的共享名      
服务器变量   
%h  Samba服务器的DNS名字  
%L  Samba服务器的Netbios名字      
%v  Samba版本   
其他变量      
%T  当前日期和时间

security = user   //使用的安全等级,默认值为user,
       其安全等级分为5类:
(1)share
   当客户端连接到该等级的Samba服务器时,不需要输入账号和密码,就可以访问samba服务器上的共享
资源,但安全性无法保证.
(2)user
   用户需要输入有效的密码,通过验证后才能使用服务器的共享。
(3)server
   与user等级相同,也需要输入有效的账号和密码,但需要指定口令服务器:;   password server =  
<NT-Server-Name>
eg: security = server
    password server= SMB2
    smb passwd file =/etc/samba/smbpasswd_smb2
(4)Samba服务器加入到windows NT域中后,samba的服务器不再负责账号和密码的验证,统一由域控制
器负责,则使用访安全等级,同时也必须指定口令服务器。
(5)ads安全等级
Samba服务器加入到windows活动目录后,使用访安全等级。同时也需要指定口令服务器.

;  password level = 8
;  username level = 8  //用户名和密码长度限制.

encrypt passwords = yes  //使用口令加密
smb passwd file = /etc/samba/smbpasswd  //smaba账号存放文件,注意误必采用加密形式,否则要改win注册表,应为win也采用啦加密方式.

username map = /etc/samba/smbusers //用户映射
功能:将不同的用户映射成为一个用户,
#vi /etc/samba/smbusers
复制内容到剪贴板
代码:
root = administrator admin
nobody = guest pcguest smbguest
格式:
单独的linux账号 = 要映射的windows账号列表.
netseek = testok

;   interfaces = 192.168.12.2/24 192.168.13.2/24  //监听多个网卡
格式:interfaces = 网卡IP地址或网络接口.
eg: interfaces = eth0
wins support = yes  //设置samba充当wins服务器(WINS 名称服务)
wins server = w.x.y.z  //设置wins服务的IP地址.

#testparm //技巧:检查smb.conf 配置文件内是否存在语法错误:

[homes] 设置共享目录:
复制内容到剪贴板
代码:
[homes]
   comment = Home Directories   //目录文字说明
   browseable = no              //是否允许用户浏览homes主目录,建议使用默认值,不允许.
   writable = yes               //是否允许写入个人主目录.
comment = 文字说明内容.
browseable = no 表示禁止浏览,也就是本目录只参有权使用的用户是可以看到的.
writable = yes 允许有权限限的用户写入
vaiid users = netseek,lin,@share 只允许netseek,lin,用户share组的.

设置一个共享目录:
复制内容到剪贴板
代码:
[shares]
   comment = NetSeek's share Directory
   read list = netseek
   write list = @share
   path = /home/share
注:netseek 这个用户可以读,share组的用户可以读写,所有testok这个用户对这个目录可读可写.

复制内容到剪贴板
代码:
[printers]  共享打印
   comment = All Printers
   path = /var/spool/samba
   browseable = no
                  //如果允许guest 打印,只需在末尾加入public = yes
复制内容到剪贴板
代码:
# Set public = yes to allow user 'guest account' to print
   guest ok = no  
   writable = no
   printable = yes
3.用户创建:
系统用户映射给samba
#cat /etc/passwd | /usr/bin/mksmbpasswd.sh > /etc/samba/smbpasswd
为用户添加SMB口令:
#smbpasswd netseek
New SMB password:*******
Retype new SMB password:*******

添加新用
为系统加用户后,再添加到samba用户中:
#adduser smb
#smbadduser smb:wsmb(可以不一样,不过管理员为啦好记忆,可以用一样的.)

给上面定义的share目录添加samba用户:
复制内容到剪贴板
代码:
#groupadd share
#useradd testok
#smbpasswd testok
#usermod -G share testok 将test用户添加到share组中
#mkdir /home/share
#chown :share /home/share
#chmod -c g+rwx /home/share 设置share组对该目录有读写和执行权限
4.服务启动:
复制内容到剪贴板
代码:
/etc/rc.d/init.d/smb start
/etc/rc.d/init.d/smb restart
#chkconfig smb on
#chkconfig --list smb
四,访问Samba服务器:

1.Linux客房机访问Samba共享服务:
smbclient -L //主机名或IP -U 登陆名 //列出共享
smbclient -L //localhost  查看本共情况.

[root@oracle ~]# smbclient -L //oracle.dolinux.cn  查看Samba服务器共享情况.
复制内容到剪贴板
代码:

Password:
Domain=[ORACLE] OS=[Unix] Server=[Samba 3.0.10-1.4E.2]
smb: \>
Password:
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.10-1.4E.2]

        Sharename       Type      Comment
        ---------       ----      -------
        tech            Disk      Tech 's Files
        market          Disk      Market 's Files
        Software        Disk      Share Software
        TmpUpload       Disk      Temp Files
        IPC$            IPC       IPC Service (NetSeek's Samba server)
        ADMIN$          IPC       IPC Service (NetSeek's Samba server)
Anonymous login successful
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.0.10-1.4E.2]

        Server               Comment
        ---------            -------
        IBM-5B367FC73A5      
        ORACLE               NetSeek's Samba server

        Workgroup            Master
        ---------            -------
        WORKGROUP            IBM-5B367FC73A5
        smbclient //主机名或IP/共享文件夹  -U  登陆名
[root@oracle ~]# smbclient //oracle.dolinux.cn/tech -U seek
Password:
Domain=[ORACLE] OS=[Unix] Server=[Samba 3.0.10-1.4E.2]
smb: \> (ls,put,get,mput *,mget *)

smbstatus查看Samba资源状态:
#smbstatus -d   查看目前Samba服务的使用状况.
#smbstatus -u netseek

加载资源:
       smbmount 共享资源列表 加载点 -o 参数
       smbumount 加载点
       smbmount //主机名或IP/share -o username=netseek (或者mount)
#smbmount //oracle.dolinux.cn/tech /mnt/share/ -o username=seek
#mount -t smbfs -o username=seek,password=seek //oracle.dolinux.cn/tech /mnt/share/
                   //上面的命令效果相同
#smbumount /mnt/share 或者umount /mnt/share 卸载挂载点.

2.Windows客户主机访问Samba服务器.
   通过网邻居.

五,SWAT,Samba web管理工具
1.SWAT(Samba web Administration Tool,Samba web )
# rpm -ivh samba-swat-3.0.10-1.4E.2.i386.rpm //安全WEB配置管理工具
复制内容到剪贴板
代码:

#vi /etc/xinetd.d/swat
service swat
{
        port            = 901
        socket_type     = stream
        wait            = no
        only_from       = 127.0.0.1 192.168.0.1
        user            = root
        server          = /usr/sbin/swat
        log_on_failure  += USERID
        disable         = no
}
#service xinetd restart
#chkconfig swat on
http://192.168.0.1:901
六,企业应用案例.

要求:
1.所有的员工在公司都能流动办公,都能把自己的文件保存到Samba服务器上.
2.技术部和市场部都有各参的目录,同一个部门的人拥有一个共享目录,共它部门的人都只能访问在
  服务器上的自己home目录.
3.所有的用户都不允许使用服务器上的shell,只能通过Samba访问服务器.
4.要求提供一个软件共享目录,存放一个常用软件,供公司员工使用.
5.提供临是文件目录,任何用户都可以对其进行读写(最好是,谁放在这里面的,谁可以删)

分析:
1.要求员工都能流动办公,都能把文件保存Samb服务器上,这个利用home目录就可以实现.
2.创建market,tech组,创建组共享目录.
3.利用不可用的shell就可以如,/bin/false.
4.软件共享:software  公司任何人都可以访问, 不能写.
5.TmpUpload:临时上传文件:
公司员工名单:
总经理:ceo
财务:finance
技术部: tech(seek,len,gao,popo)
市场部:market(jake,joe,linda,gavin)

复制内容到剪贴板
代码:

#groupadd tech
#groupadd market
#useradd -g tech seek -s /bin/false
#useradd -g market jake -s /bin/false
#smbpasswd -a seek
#smbpasswd -a jake //这样一个一个添加用户,我们可以利用for添加批量的用户:

#for user in seek len gao popo
>do
>useradd -g tech -s /bin/false $user
>smbpasswd -a $user
>done
New...passwd:一个一个的给其添加密码,市场部同样可以利用for批量添加用户.

#useradd ceo
#useradd finance
#smbpasswd -a ceo
#smbpasswd -a finance

建立共享目录
#mkdir /home/tech /home/market
#ls -ld /home/tech /home/market
#chgrp tech /home/tech
#chgrp market /home/market
#chmod 3770 /home/tech
#chmod 3770 /home/market
(并且设定SGID和粘滞位使得所有在这个目录中建立的文件都拥有tech组的权限并且组中其他的人不能
  删除该用户建立的文件。)

复制内容到剪贴板
代码:

#mkdir /software
#mkdir /tmpupload
#chmod 777 /tmpupload
#chmod a+t /tmpupload

#vi /etc/samba/smb.conf 添加共享目录配置文件
复制内容到剪贴板
代码:

[tech]
    comment = Tech 's Files
    path = /home/tech
    public = no
    valid users = @tech
    write list = @tech
    create mask = 0770
    directory mask = 0770
[market]
    comment = Market 's Files
    path = /home/market
    public = no
    valid users = @market
    write list = @market
    create mask = 0770
    directory mask = 0770

[Software]
    comment = Share Software
    path = /software
    public = yes
    read only = yes
[TmpUpload]
    comment = Temp Files
    path = /tmpupload
    public = yes
    writable = yes
   
#servcie smb restart 重启Samba服务开始测试,我已经在我的机子测试好啦
积极!努力!低调!百折不挠!
分享才能进步!帮助他人就是在帮助自己! 共同学习探讨Linux!
  Linux= howto+man ! ^_^

TOP

实战文章,顶一下,希望能继续深入发掘samba的功能,特别是企业级的功能!
开源,人人为我,我为人人!

TOP

謝謝,寫得非常好.

非常感謝你的文章,但我有一個問題想要請教,為什麼我的默認共享tmp文件夾可以被訪問,但是我自己新建的卻不可以呢?而且我也把那個文件夾的權限設置為777了.我的msn是lkmiycay@hotmail.com,非常渴望得到你的指教.
為什麼這麼難啊?

TOP

不知道你是否添加啦访问samba服务的用户,如果只把目录权限全共享出来,而没有添加相关的访问目录的用户好像是不可行的.
积极!努力!低调!百折不挠!
分享才能进步!帮助他人就是在帮助自己! 共同学习探讨Linux!
  Linux= howto+man ! ^_^

TOP

我把配置放上来,你帮我看下.

# 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 made any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name
   workgroup = xuanlong
   netbios name = linux
# server string is the equivalent of the NT Description field
   server string = Samba(PDC) 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.2. 127.0.0.1

# if you want to automatically load your printer list rather
# than setting them up individually then you'll need this
   printcap name = /etc/printcap
   load printers = yes

# 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

# This option tells cups that the data has already been rasterized
cups options = raw

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
;  guest account = pcguest

# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/%m.log
# all log information in one file
#   log file = /var/log/samba/log.smbd

# Put a capping on the size of the log files (in Kb).
   max log size = 50

# Security mode. Most people will want user level security. See
# security_level.txt for details.
   security = user
# Use password server option only with security = server
;   password server = <NT-Server-Name>

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
;  password level = 8
;  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
  smb passwd file = /etc/samba/smbpasswd

# The following are needed to allow password changing from Windows to
# update the Linux system 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.
;  unix password sync = Yes
;  passwd program = /usr/bin/passwd %u
;  passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*

# Unix users can map to different SMB User names
;  username map = /etc/samba/smbusers

# 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

# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
;   socket options = TCP_NODELAY IPTOS_LOWDELAY  SO_RCVBUF=8192 SO_SNDBUF=8192
   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

# 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
# Cause this host to announce itself to local subnets here
;   remote announce = 192.168.1.255 192.168.2.44

# 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 = yes

# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
;   os level = 64

# 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 for
# 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 = netlogon.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
;   logon driver = H:
;   logon level = 2

# All NetBIOS names must be resolved to IP Addresses
# 'Name Resolve Order' allows the named resolution mechanism to be specified
# the default order is "host lmhosts wins bcast". "host" means use the unix
# system gethostbyname() function call that will use either /etc/hosts OR
# DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
# and the /etc/resolv.conf file. "host" therefore is system configuration
# dependant. This parameter is most often of use to prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that are NOT
# on the local network segment
# - OR - are not deliberately to be known via lmhosts or via WINS.
; name resolve order = wins lmhosts bcast

# 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 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 = yes

# 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 ==============================
   idmap uid = 16777216-33554431
   idmap gid = 16777216-33554431
   template shell = /bin/false
   winbind use default domain = no
[homes]
;   path = %H
   comment = Home Directories
   valid users = %S
   create mode = 0600
   directory mode = 0700
   locking = no
;   browseable = no
   writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
;[netlogon]
;  comment = Network Logon Service
;  path = /home/netlogon
;  read only = yes
;  browseable = no
;  write list = root


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
;    path = /home/samba/profiles
;    browseable = no
;    writeable = yes
;    create mask = 0600
;    directory mask = 0700


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual 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

[sharelong]
   comment = sharelong group's share
   path = /usr/sharelong
   browseable = yes
   writable = yes
;   users list
   read only = no
   valid users = @sharelong
   create mask = 0755
   create directory = 0755
   force group = sharelong
   oplocks = false

# A publicly accessible directory, but read only, except for people in
# the "staff" group
;[public]
;   comment = Public Stuff
;   path = /home/samba
;   public = yes
;   read only = yes
;   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 = /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]
;   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


上面那个sharelong的共享无论怎样就不行,能看到里面,但不能写东西进去.我工作站用的是xp,samba服务器用的是fedora.samba版本是3.0.14.
那个sharelong文件夹权限是:

[root@samba usr]# ls
bin  games    kerberos  libexec  sbin   sharelong  tmp
etc  include  lib       local    share  src        X11R6
[root@samba usr]# ls -ld sharelong
drwxrwxrwx  2 sharelong1 sharelong 4096  4月  2 17:21 sharelong
[root@samba usr]#
為什麼這麼難啊?

TOP

我在smbpasswd 里的用户是这些.

sharelong1:500:44EFCE164AB921CAAAD3B435B51404EE:32ED87BDB5FDC5E9CBA88547376818D4:[U ]CT-442B71C4: sharelong2:501:56B59FE5C2E803B4AAD3B435B51404EE:C2081DA95C0DAD21F8E7818EE6F6DA18:[U ]CT-442B71D9: slcs$:503:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:50F2FF894A0C752EC5A9436CEAD40C08:[W ]CT-442B86EC: root:0:0182BD0BD4444BF8DF550CCC5E5E7C7A:1D40A8C33B543D46503101F64910A556:[U ]:LCT-442B807A: 还有在winxp里登入共享是可以的.[/img]
為什麼這麼難啊?

TOP

谢谢你的帖子

有没有关于磁盘配额的

TOP

有简单的

一、挂接硬盘,分区:(本例为挂接一个hda硬盘)
1、        装好新硬盘,启动计算机
2、        执行 # fdisk –l  查看磁盘分区,找到新添加的硬盘如本例中的/dev/hda
3、        # fdisk /dev/hda  为/dev/hda进行分区
① m键,查看帮助信息;
② n键,创建一个新的分区,(其中选p则创建一个主分区,序号为1-4,选e则创建一个扩展分区。)
③选p创建第一个主分区,(按默认值即可,空间大小设定格式为:+nM,如+200M
④重复②③步,创建其它所需的主分区和扩展分区;
⑤扩展分区创建后,重复②,将提示创建逻辑分区,选l;(注意分区标号,逻辑分区标号为5以后的数值;
⑥全部创建完成后,输入p键,查看分区状况及磁盘文件类型(默认的为ext3)
⑦如需更改磁盘文件类型,输入t,选磁盘号,在l列表中找到所需的型号,输入即可修改;
⑧如对分区不满意,q键不保存退出,可返回3重新分区;如果确定无误,w键存盘。
4、# fdisk –l (这时可以看到新建所有分区的情况,但新分区未格式化)
5、# mkfs.ext3  /dev/hda1 2 3……(按4中所显示的新分区的顺序,对分区进行格式化)
6、# mkdir /mnt/had(1,2,3)   创建挂接目录,(注意路径,本例为/mnt下的目录)
7、# mount –t ext3 /dev/hda1 /mnt/hda1  (挂接分区,本例是将第一个新分区挂接到/mnt/hda1)
8、重复7挂接其它的分区;(即挂接新分区至指定的目录,就是在步骤6中所建的目录)
9、修改/etc/fstab;
   ① # vi /etc/fstab
② 添加如下内容:
/dev/hda1           /mnt/hda1             ext3      auto              0 0
/dev/hda2           /mnt/hda2             ext3      auto              0 0
。。。。。。。。。。。。。。。。。。。。。
③:wq存盘退出。
10、重启机器,挂接成功。可用#df 命令查看。

二、进行磁盘配额(以上面挂接好的分区/dev/hda1为例)
① # vi /etc/fstab(在所需要配额的分区auto后加入usrquota,grpquota中间用逗号隔开)
如本例中为:
/dev/hda1         /mnt/hda1              ext3      auto,usrquota,grpquota  0 0
② # vi /etc/rc.d/rclocal
在最后加入/sbin/quotaon –auvg (开机启用所做的配额选项)
③ # quotacheck –cug /dev/hda1   (在hda1目录下生成aquto.use和aquto.group文件)
④ # useradd test
   # passwd test          创建test用户
⑤ # edquota –u test        为test用户进行配额,修改soft和hard下的两个数值,其中hard>=soft
⑥ # quotaon –u test     启用配额或重启计算机。
或  quotaon –a          启用所有配额
⑦ # quota –v  可查看配额情况
⑧ 如果要停用,# quotaoff  -a
9、 组配额:①②③步与组配额一致
第④步:#groupadd tests
第⑤步:#Edquato –g tests
然后组中添加成员,启动配额
注:仅初始组可进行配额,组中所有成员共享配额

TOP

太好了,我回去试试,我安装的时候可能出现几个问题,回去研究一下~
linux从头开始...

TOP

:L :L :L :L :L 看起来还可以,但实际....

TOP

发新话题