当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 10 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-21 0:51 
头像

注册: 2008-06-04 1:17
帖子: 49
送出感谢: 0 次
接收感谢: 0 次
今天在网上搜了一圈,发现扯到Samba的文章不是断章取义就是乱抄一气,实在无法忍受了。所以我决定还是写一点东西好。
方法呢大部分是参考了Ubuntu官方的文档,然后有些地方会有所不同。Samba最基本的目的就是实现Linux和Ubuntu的文件共享,其他的Linux版本暂时我还没时间去玩,因此在这里就直接用9.10和XP说一下了。

  • 以XP为主机,Ubuntu做客户端
    1. 如果你想使一个网络专门用于本地计算机和其他网络中计算机进行文件分享的话呢,那就新建一个吧。
    2. 首先进入控制面板,进入网络安装向导,然后下一步,下一步
    3. 在“选择连接方法”的时候呢,根据你自己所在的网络情况做选择。比如,因为我这里的两台计算机都是通过路由接入公网的,所以我选了第二项。然后下一步
    4. 计算机名一般系统都自动给出的,一般就是指hostname,随便你改不改,next
    5. 工作组名的作法与上一步相似,大概这里指代的是域名,next
    6. 废话,当然是启用啦,next
    7. 等一会儿后,选结束向导。重启就可以了
      引用:
      很多人说重启了之后在网上邻居看不到自己刚新建的网络,那很可能是Computer Browser服务没有开。如果我没记错的话呢,应该是这样的:
      1. 开始 -> 运行 -> services.msc
      2. 先启动Server服务和Workstation服务,然后再启动Computer Browser服务
      3. 如果不想每次开机都自己手动开启这些服务的话呢,把它们设成“自动”吧
    8. 然后随便找个想分享的文件夹,右击,共享与安全,设置一下共享名和权限就可以了
    9. 然后进入Ubuntu设置客户端。假设此时你的Ubuntu还没有装samba。所以先安装:
      代码:
      sudo apt-get update
      sudo apt-get install samba smbfs nautilus-share
    10. 装完后点“位置” -> "连接到服务器"
    11. 服务类型为"Windows共享",服务器填Windows的主机IP
      引用:
      尽管有人会填刚刚在Windows里面设置的计算机名,但请你查一下/etc/hosts有没有相对应的映射。如果没有,要么就改hosts,要么就直接填IP。当时我就是不知道自己的hostname没有映射,所以登了半天还是登不上
      。共享就填Windows里面设置的共享名,其他都空白,然后"连接"
    12. 会跳出来对话框。用户名可以不管它(因为装samba的时候系统可能自动就帮你设置好了),但是密码要填Windows中的Guest账户密码。关于Guest账户的设置我们待会儿再说。然后连接。
    13. 如果没有什么意外的话,应该就成功登录Windows上所要分享的位置了
  • 以Ubuntu作主机,XP作客户端
    1. 用Ubuntu作主机就比较简单了,直接分享你要分享的文件就可以了。别忘了设置好的共享名
    2. 进入Windows,然后在"我的电脑"里的"工具"中选"映射网络驱动器"
    3. 跟在Ubuntu作为客户端时的设置相似,文件夹填"\\Ubuntu主机的IP\共享名"
      引用:
      如果要填主机名,还是老办法,到C:\WINDOWS\system32\drivers\etc\hosts中看一下有没有相应的映射,然后自己看着办吧。
    4. 没出太大的问题,应该就成功了


_________________
Benedicat nos Deus, Deus noster, benedicat nos Deus
ACER 4736G


页首
 用户资料  
 
2 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-21 1:48 
头像

注册: 2008-06-04 1:17
帖子: 49
送出感谢: 0 次
接收感谢: 0 次
关于Guest账户的问题,也是网上找的答案。在这里简单说一下。
  1. 根据上面链接所指的文章来看,XP对于Guest的安全策略是比较保守的。基本上XP的局域网文件分享就是通过Guest账户进行的,所以先启用Guest账户
  2. 控制面板 -> 管理工具 -> 计算机管理 -> 本地用户和组 -> 用户,右击Guest,属性,去掉"帐户已停用"的钩,确定后再右击,设置密码。
    引用:
    这里的密码就是前面提到的Guest账户密码,最好不要留空白。想要留空白的情况请看步骤6。
  3. 修改"组策略"。开始 -> 运行 -> gpedit.msc -> 计算机配置 -> Windows设置 -> 安全设置 -> 本地策略 -> 用户权利指派
  4. 双击"拒绝从网络访问这台计算机",看一下有没有"guest“,有的话删掉"guest"
  5. 然后回到"本地策略",进入"安全选项",双击“网络访问:本地账号的共享和安全模式”,把“仅来宾—本地用户以来宾身份验证”改成“经典:本地用户以自己的身份验证“
  6. 还是在“安全选项”中,双击“使用空白密码的本地账户只允许进行控制台登录”,停用它。
以上就是这些,欢迎补充。


_________________
Benedicat nos Deus, Deus noster, benedicat nos Deus
ACER 4736G


页首
 用户资料  
 
3 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-22 1:40 
头像

注册: 2008-06-04 1:17
帖子: 49
送出感谢: 0 次
接收感谢: 0 次
又发现一个问题,不知道是我机子设置的问题还是Windows本来就默认设置的,症状是:
  1. 我要分享的文件夹Incoming在G盘根目录,权限为“读,写”。分享正常。
  2. 我要分享的文件夹vo在E盘的home\augustine\文件夹下面,无法分享。报错说找不到分享位置。
  3. 我要分享的文件夹home在E盘根目录,无法分享。报错说“您没有查看……的权限”
好了,问题说到这里,大概出岔子的地方不会在Ubuntu的客户端,因为Incoming分享是正常的。那么,肯定就是Windows上面分享的问题了。
  1. 首先,既然是扯到权限,那就去管理权限的地方看看。一个地方是“组策略”
    代码:
    开始 -> gpedit.msc -> 计算机配置 -> Windows设置 -> 安全设置 -> 本地策略 ->用户权利指派
    一看,发现“拒绝本地登录”和“在本地登录”中都有Guest,删之。(不知道这管不管用,个人猜想问题不在这个地方)
  2. 然后是共享目录的权限属性。
    代码:
    网上邻居 -> 分享主机所在的域 -> 分享目录所在的主机 -> 分享目录 -> 属性 -> 安全
    对比了一下Incoming和vo的权限设定,果然这里出现了很大的不同。vo中没有Everyone组,甚至Guest账户也没有。于是添加了Everyone组,并且拥有完全控制的权限。然后再试了一下。
  3. 还是无法读写!那试试home呢?于是又把home的权限也按照Guest的属性改了。成功。
  4. 后来想了下,感觉有道理。因为vo是home的子目录,改权限的时候Windows提示说如果要改根目录的权限,那么根目录的子文件和子文件夹的权限都得改(有点像chmod -R)但是vo不是根目录,而home的权限依旧没有改。所以ubuntu上的samba client自然就找不到分享位置了。
引用:
Windows的权限了解地不是很清楚,尤其是那个“继承于”的选项,怎么改都改不了,也不知道怎么回事。若有错误请指正。


_________________
Benedicat nos Deus, Deus noster, benedicat nos Deus
ACER 4736G


页首
 用户资料  
 
4 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-29 16:07 

注册: 2008-01-15 12:33
帖子: 11
送出感谢: 0 次
接收感谢: 0 次
好文,解决问题了!


页首
 用户资料  
 
5 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-29 17:55 

注册: 2007-08-08 11:42
帖子: 37
送出感谢: 0 次
接收感谢: 0 次
确实不错。支持楼主


页首
 用户资料  
 
6 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-01-29 18:06 
头像

注册: 2008-04-14 23:29
帖子: 2114
地址: 曾也在NB大学呆过
送出感谢: 3
接收感谢: 10
这东西只用过一次。
路由器连接的另一台电脑WINDOWS7。
我在nautilus地址上输入smb://192.168.0.xxx,输入用户名,密码就进去了。 :em06 :em06


页首
 用户资料  
 
7 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-04-20 11:47 

注册: 2010-03-03 7:55
帖子: 35
送出感谢: 0 次
接收感谢: 0 次
以Ubuntu作主机,XP作客户端

1. 用Ubuntu作主机就比较简单了,直接分享你要分享的文件就可以了。别忘了设置好的共享名
2. 进入Windows,然后在"我的电脑"里的"工具"中选"映射网络驱动器"
3. 跟在Ubuntu作为客户端时的设置相似,文件夹填"\\Ubuntu主机的IP\共享名"
引用:
如果要填主机名,还是老办法,到C:\WINDOWS\system32\drivers\etc\hosts中看一下有没有相应的映射,然后自己看着办吧。
4. 没出太大的问题,应该就成功了

我按楼主的方法,但不成功。用的是UBUNTU910桌面版,我的sam.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# 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 most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)
security=user
[lzh]
path=/home/user1/lzh
valid users=user1
public=no
writable=yes

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no

# 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

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam

obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user

########## Domains ###########

# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups

############ Misc ############

# 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 = /home/samba/etc/smb.conf.%m

# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
# socket options = TCP_NODELAY

# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
# domain master = auto

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash

# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
; share modes = no

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin

# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes

# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom

root@lzxjzxxx-desktop:/etc/samba# testparm
Unknown parameter encountered: "valid users"
Ignoring unknown parameter "valid users"
Unknown parameter encountered: "public"
Ignoring unknown parameter "public"
Unknown parameter encountered: "writable"
Ignoring unknown parameter "writable"
Global parameter dns proxy found in service section!
Global parameter log file found in service section!
Unknown parameter encountered: "max log size"
Ignoring unknown parameter "max log size"
Unknown parameter encountered: "syslog"
Ignoring unknown parameter "syslog"
Global parameter panic action found in service section!
Global parameter encrypt passwords found in service section!
Unknown parameter encountered: "passdb backend"
Ignoring unknown parameter "passdb backend"
Global parameter obey pam restrictions found in service section!
Unknown parameter encountered: "unix password sync"
Ignoring unknown parameter "unix password sync"
Unknown parameter encountered: "passwd program"
Ignoring unknown parameter "passwd program"
Global parameter passwd chat found in service section!
Unknown parameter encountered: "pam password change"
Ignoring unknown parameter "pam password change"
Unknown parameter encountered: "map to guest"
Ignoring unknown parameter "map to guest"
Unknown parameter encountered: "usershare allow guests"
Ignoring unknown parameter "usershare allow guests"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Loaded smb config files from /etc/samba/smb.conf
lp_load: refreshing parameters from /etc/samba/smb.conf
Processing section "[lzh]"
Unknown parameter encountered: "valid users"
Ignoring unknown parameter "valid users"
Unknown parameter encountered: "public"
Ignoring unknown parameter "public"
Unknown parameter encountered: "writable"
Ignoring unknown parameter "writable"
Global parameter dns proxy found in service section!
Global parameter log file found in service section!
Unknown parameter encountered: "max log size"
Ignoring unknown parameter "max log size"
Unknown parameter encountered: "syslog"
Ignoring unknown parameter "syslog"
Global parameter panic action found in service section!
Global parameter encrypt passwords found in service section!
Unknown parameter encountered: "passdb backend"
Ignoring unknown parameter "passdb backend"
Global parameter obey pam restrictions found in service section!
Unknown parameter encountered: "unix password sync"
Ignoring unknown parameter "unix password sync"
Unknown parameter encountered: "passwd program"
Ignoring unknown parameter "passwd program"
Global parameter passwd chat found in service section!
Unknown parameter encountered: "pam password change"
Ignoring unknown parameter "pam password change"
Unknown parameter encountered: "map to guest"
Ignoring unknown parameter "map to guest"
Unknown parameter encountered: "usershare allow guests"
Ignoring unknown parameter "usershare allow guests"
Processing section "[printers]"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Processing section "[print$]"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Loaded services file OK.
Press enter to see a dump of your service definitions

Press enter to see a dump of your service definitions

# Global parameters
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
security = USER
prefork children:smb = 4
registry:hkey_users = hku.ldb
registry:hkey_local_machine = hklm.ldb
auth methods:standalone = anonymous sam_ignoredomain
auth methods:member server = anonymous sam winbind
auth methods:domain controller = anonymous sam_ignoredomain
comment =
path =
ntvfs handler = unixuid, default
read only = Yes
create mask = 0744
force create mode = 00
directory mask = 0755
force directory mode = 00
hosts allow =
hosts deny =
max connections = -1
strict sync = No
case insensitive filesystem = No
max print jobs = 1000
printable = No
printer name =
map system = No
map hidden = No
map archive = Yes
browseable = Yes
csc policy = manual
strict locking = Yes
oplocks = Yes
copy =
include =
available = Yes
volume =
fstype = NTFS
msdfs root = No

[lzh]
path = /home/user1/lzh

[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers

[IPC$]
comment = IPC Service (%h server (Samba, Ubuntu))
path = /tmp
ntvfs handler = default
browseable = No
fstype = IPC

[ADMIN$]
comment = DISK Service (%h server (Samba, Ubuntu))
path = /tmp
browseable = No
fstype = DISK


附件:
screenshot_001.png
screenshot_001.png [ 33.31 KiB | 被浏览 3342 次 ]

页首
 用户资料  
 
8 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-04-20 17:05 
头像

注册: 2007-07-11 21:43
帖子: 3382
地址: 东江边
系统: archlinux
送出感谢: 15
接收感谢: 7
如果双方都在路由后面怎么办,而且还有一个是校园网。


_________________
我来了,我看见了,我征服了!
求勾搭,不管饭。


页首
 用户资料  
 
9 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-06-14 23:07 
头像

注册: 2008-06-04 1:17
帖子: 49
送出感谢: 0 次
接收感谢: 0 次
lzxjzxxx 写道:
以Ubuntu作主机,XP作客户端

1. 用Ubuntu作主机就比较简单了,直接分享你要分享的文件就可以了。别忘了设置好的共享名
2. 进入Windows,然后在"我的电脑"里的"工具"中选"映射网络驱动器"
3. 跟在Ubuntu作为客户端时的设置相似,文件夹填"\\Ubuntu主机的IP\共享名"
引用:
如果要填主机名,还是老办法,到C:\WINDOWS\system32\drivers\etc\hosts中看一下有没有相应的映射,然后自己看着办吧。
4. 没出太大的问题,应该就成功了

我按楼主的方法,但不成功。用的是UBUNTU910桌面版,我的sam.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# 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 most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#

#======================= Global Settings =======================

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)
security=user
[lzh]
path=/home/user1/lzh
valid users=user1
public=no
writable=yes

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no

# 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

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0

# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes



#### Debugging/Accounting ####

# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
max log size = 1000

# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam

obey pam restrictions = yes

# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes

# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user

########## Domains ###########

# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile

# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U

# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd

# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u

# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g

########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups

############ Misc ############

# 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 = /home/samba/etc/smb.conf.%m

# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
# socket options = TCP_NODELAY

# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
# domain master = auto

# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash

# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes

# Setup usershare options to enable non-root users to share folders
# with the net usershare command.

# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100

# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes

#======================= Share Definitions =======================

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S

# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
; share modes = no

# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin

# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes

# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom

root@lzxjzxxx-desktop:/etc/samba# testparm
Unknown parameter encountered: "valid users"
Ignoring unknown parameter "valid users"
Unknown parameter encountered: "public"
Ignoring unknown parameter "public"
Unknown parameter encountered: "writable"
Ignoring unknown parameter "writable"
Global parameter dns proxy found in service section!
Global parameter log file found in service section!
Unknown parameter encountered: "max log size"
Ignoring unknown parameter "max log size"
Unknown parameter encountered: "syslog"
Ignoring unknown parameter "syslog"
Global parameter panic action found in service section!
Global parameter encrypt passwords found in service section!
Unknown parameter encountered: "passdb backend"
Ignoring unknown parameter "passdb backend"
Global parameter obey pam restrictions found in service section!
Unknown parameter encountered: "unix password sync"
Ignoring unknown parameter "unix password sync"
Unknown parameter encountered: "passwd program"
Ignoring unknown parameter "passwd program"
Global parameter passwd chat found in service section!
Unknown parameter encountered: "pam password change"
Ignoring unknown parameter "pam password change"
Unknown parameter encountered: "map to guest"
Ignoring unknown parameter "map to guest"
Unknown parameter encountered: "usershare allow guests"
Ignoring unknown parameter "usershare allow guests"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Loaded smb config files from /etc/samba/smb.conf
lp_load: refreshing parameters from /etc/samba/smb.conf
Processing section "[lzh]"
Unknown parameter encountered: "valid users"
Ignoring unknown parameter "valid users"
Unknown parameter encountered: "public"
Ignoring unknown parameter "public"
Unknown parameter encountered: "writable"
Ignoring unknown parameter "writable"
Global parameter dns proxy found in service section!
Global parameter log file found in service section!
Unknown parameter encountered: "max log size"
Ignoring unknown parameter "max log size"
Unknown parameter encountered: "syslog"
Ignoring unknown parameter "syslog"
Global parameter panic action found in service section!
Global parameter encrypt passwords found in service section!
Unknown parameter encountered: "passdb backend"
Ignoring unknown parameter "passdb backend"
Global parameter obey pam restrictions found in service section!
Unknown parameter encountered: "unix password sync"
Ignoring unknown parameter "unix password sync"
Unknown parameter encountered: "passwd program"
Ignoring unknown parameter "passwd program"
Global parameter passwd chat found in service section!
Unknown parameter encountered: "pam password change"
Ignoring unknown parameter "pam password change"
Unknown parameter encountered: "map to guest"
Ignoring unknown parameter "map to guest"
Unknown parameter encountered: "usershare allow guests"
Ignoring unknown parameter "usershare allow guests"
Processing section "[printers]"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Processing section "[print$]"
Unknown parameter encountered: "guest ok"
Ignoring unknown parameter "guest ok"
Loaded services file OK.
Press enter to see a dump of your service definitions

Press enter to see a dump of your service definitions

# Global parameters
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
security = USER
prefork children:smb = 4
registry:hkey_users = hku.ldb
registry:hkey_local_machine = hklm.ldb
auth methods:standalone = anonymous sam_ignoredomain
auth methods:member server = anonymous sam winbind
auth methods:domain controller = anonymous sam_ignoredomain
comment =
path =
ntvfs handler = unixuid, default
read only = Yes
create mask = 0744
force create mode = 00
directory mask = 0755
force directory mode = 00
hosts allow =
hosts deny =
max connections = -1
strict sync = No
case insensitive filesystem = No
max print jobs = 1000
printable = No
printer name =
map system = No
map hidden = No
map archive = Yes
browseable = Yes
csc policy = manual
strict locking = Yes
oplocks = Yes
copy =
include =
available = Yes
volume =
fstype = NTFS
msdfs root = No

[lzh]
path = /home/user1/lzh

[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers

[IPC$]
comment = IPC Service (%h server (Samba, Ubuntu))
path = /tmp
ntvfs handler = default
browseable = No
fstype = IPC

[ADMIN$]
comment = DISK Service (%h server (Samba, Ubuntu))
path = /tmp
browseable = No
fstype = DISK







:em20
我猜大概是Windows端的问题,可能是Guest用户没给权限,或者是给防火墙挡住了什么的……
不过这里面的未知因素蛮多的,比如有的软件会额外删改权限之类,那就比较麻烦了~ :em06


_________________
Benedicat nos Deus, Deus noster, benedicat nos Deus
ACER 4736G


页首
 用户资料  
 
10 楼 
 文章标题 : Re: Samba在Ubuntu 9.10上的简单应用
帖子发表于 : 2010-06-14 23:18 
头像

注册: 2008-06-04 1:17
帖子: 49
送出感谢: 0 次
接收感谢: 0 次
momova 写道:
如果双方都在路由后面怎么办,而且还有一个是校园网。


嗯……,破路由的方法有很多,有温柔的破法(比如用个社会工程学方法之类的),也有比较野蛮的破法(比如某种邪恶的方法……在此不细说)。 :em09

因为不同学校校园网的条件也不同,所以很难有一种统一的方案来解决。毕竟每个学校对于校园网的利益出发点是不同的。不过就一般地来讲,校园网应该都有一定的权限让你做资源共享的。具体怎么获得这些权限,恩,烦请这位路人参考Kevin Mitnick的The Art of Deception。


_________________
Benedicat nos Deus, Deus noster, benedicat nos Deus
ACER 4736G


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 10 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译