如果你的电脑上安装并运行了samba可以用smbclient命令:
Usage: smbclient service [options]
Version 2.2.1a
-s smb.conf pathname to smb.conf file
-O socket_options socket options to use
-R name resolve order use these name resolution services only
-M host send a winpopup message to the host
-i scope use this NetBIOS scope
-N don't ask for a password
-n netbios name. Use this name as my netbios name
-d debuglevel set the debuglevel
-P connect to service as a printer
-p port connect to the specified port
-l log basename. Basename for log/debug files
-h Print this help message.
-I dest IP use this IP to connect to
-E write messages to stderr instead of stdout
-U username set the network username
-L host get a list of shares available on a host
-t terminal code terminal i/o code {sjis|euc|jis7|jis8|junet|hex}
-m max protocol set the max protocol level
-A filename get the credentials from a file
-W workgroup set the workgroup name
-TIXFqgbNan command line tar
-D directory start from directory
-c command string execute semicolon separated commands
-b xmit/send buffer changes the transmit/send buffer (default: 65520)
这里介绍的四款非常方便、易用的小软件,会让你查找“网络邻居”马上变得简单无比。
Gnomba??动作迅速
这个图形工具允许你扫描不同区域子网内基于SMB协议的电脑,速度要快过Windows 9X在打开“网络邻居”时所做的扫描。
在网站http://gnomba.darkcorner.net/可以下...z”压缩包或者是 RPM文件“gnomba-0.6.2-1.i386.rpm”。RPM文件只需要在X-Window的文档管理器中右击鼠标,选择“Install”就可以正常安装了。RPM文件的大小是166KB,压缩包则需要先行解包才可以安装,在“Terminal”视窗中我们可以这样做:
#tar -zxf gnomba-0.6.2.tar.gz
#cd gnomba-0.6.2
#./configure
#make
#make install
成功安装后,在/usr/bin目录中会生成一个可执行文档gnomba,在文档管理器中双击它或者是在“Terminal”中直接键入“gnomba”指令就可以启动软件。
具体解释如下:(关于访问并操作共享资源)
1、如果你要访问一台windows可以用命令:
smbclient //计算机名/共享目录 -U 登录名
说明:windows上如果是完全共享或无密码的共享则可以不写'-U 登录名',紧接着提示'password:'时可以直接回车略过。否则有输入密码。
2、如果对方是Linux/Unix,并且samba设置的是share共享则无须密码和用户名,如果是user或security级别的共享则要了。
3、一定要指定你要访问的共享目录名称登录,否则总是提示“Invalid network name in tree connect”。
4、进去后的界面很象ftp的界面,你也可以用get,put等命令,还可以用tar等。
另外,smbclient -L host是用来查看有那些资源可用,比如我用: smbclient -L Linux01
得到如下结果:
added interface ip=202.38.207.123 bcast=202.38.207.255 nmask=255.255.255.0
Password: Sharename Type Comment
--------- ---- -------
ENSOFT Disk
CDROM Disk
SHARE Disk
UNUSED Disk
WORK Disk
FUN Disk
BACKUP Disk
IPC$ IPC 远程进程间通信 Server Comment
--------- ------- Workgroup Master
--------- -------
其中有IPC的表示要密码才能访问。
[zhoulifa]
comment = zhoulifa's Printer
valid users = zhoulifa
path = /home/zhoulifa
printer = zhoulifa_printer
public = no
writable = no
printable = yes
这一段有了zhoulifa一个共享目录,此目录只允许zhoulifa访问,并且可打印.
[homes]
comment = homes's files share
valid users = %S
path = /home/%S
public = no
writable = yes
3.各段说明:
[global]段一般不需改动太多,但是你必需设计workgroup,并且要在它下面设置一个netbios name=你的共享名,使大家可以在网上邻居里看到你.
特别请大家注意的是默认好象没有netbios name这个参数的,你必需配置.
另外,security可以设计成任何的值,反正后来可以通过valid users来设定.
[home] 段:如果你不允许linux用户共享你的资源,[home]段可以全部不要,就是说虽然有登录linux的用户名和密码但不能用来访问共享内容,如果有 home段,那么每个linux用户可以看到的共享资源除了你在samba里另外设的外还有他的home里的东西.4.看一下我的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 made any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = Linux
netbios name = Linux00//关键是加入了这
# server string is the equivalent of the NT Description field
server string = Samba Server(UnicomServer)
# 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.
# 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 = lprng
# 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
# Put a capping on the size of the log files (in Kb).
max log size = 0
# Security mode. Most people will want user level security. See
# security_level.txt for details.
security = user
#============================ Share DefinitiOns==============================
[homes]
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775
# If you want users samba doesn't recognize to be mapped to a guest user
; map to guest = bad user
# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
; comment = Network Logon Service
; path = /usr/local/samba/lib/netlogon
; guest ok = yes
; writable = no
; share modes = no
# This one is useful for people to share files
[guest]
comment = Temporary file space
path = /guest
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/samba
; public = yes
; writable = yes
; printable = no
; write list = @staff
# Other examples.
#
# A private printer, usable only by fred. Spool data will be placed in fred's
# home directory. Note that fred must have write access to the spool directory,
# wherever it is.
;[fredsprn]
; comment = Fred's Printer
; valid users = fred
; path = /home/fred
; printer = freds_printer
; public = no
; writable = no
; printable = yes
# A private directory, usable only by fred. Note that fred requires write
# access to the directory.
;[fredsdir]
; comment = Fred's Service
; path = /usr/somewhere/private
; valid users = fred
; public = no
; writable = yes
; printable = no
# a service which has a different directory for each machine that connects
# this allows you to tailor configurations to incoming machines. You 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/local/pc/%m
; public = no
; writable = yes
# A publicly accessible directory, read/write to all users. Note that all files
# created in the directory by users will be owned by the default user, so
# any user with access can delete any other user's files. Obviously this
# directory must be writable by the default user. Another user 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/****************************************************************/
//Designed by ZhouLifa on April 29, 2002
//If any bug found, please inform me as soon as possible!
//Contact info:
//post addr: 广州市天河区华南理工大学计算机研究所 周立发 510640
//Computer Application Research Institution, South China University of Technology
//e-mail: zhoulifa@yahoo.com
//Tel: 020-87113239-9322
另外samba客户端等工具的使用:
(1)查看网络资源:smbclient -L //网上邻居计算机名称
列出的内容包括可用资源即是否要密码登录.IPC$说明要密码.例如:
Sharename Type Comment
--------- ---- -------
guest Disk Temporary file space
IPC$ IPC IPC Service (Samba Server(UnicomServer))
ADMIN$ Disk IPC Service (Samba Server(UnicomServer))
Server Comment
--------- -------
LINUX00 Samba Server(UnicomServer)
LINUX01 Linux01
Workgroup Master
--------- -------
LINUX LINUX01
此显示了Linux组里的Linux01计算机有guest目录可以共享,但是要密码.IPC$说明的.同组还有Linux01有可用资源.
(2)享用网络资源:smbclient //计算机名/目录名
如果是要密码的你要用:smbclient //计算机名/目录名 -U username
进去后的界面象ftp界面.可以用的命令也差不多,get,put等,还有tar命令可用的.
(3)把远程的东西当自己的东西用:smbmount //计算机名/目录名 /本地目录
比如你没有光驱,那么可以把别人的光驱mount上来:smbmount //Linux01/cdrom /mnt/cdrom
当然前提是对方(Linux01)把光驱共享了,以后你进入本地目录(/mnt/cdrom)看到的就是对方目录(cdrom里的)里的东西了.不需在smbclient去get了.
注意:用完了要smbumount /本地目录
(4)将别人的东西打包给自己smbtar,简单了,自己看man帮助吧.up!gz!