当前位置: 技术问答>linux和unix
从WINDOWS工作站如何访问LINUX工作站上的文件,也就是他们之间如何共享拷贝文件?
来源: 互联网 发布时间:2014-12-09
本文导语: 从WINDOWS工作站如何访问LINUX工作站上的文件,也就是他们之间如何共享拷贝文件? | 关于linux和windows通过网上邻居互相访问: //Designed by ZhouLifa on April 29, 2002 //If any bug found, please inform me...
从WINDOWS工作站如何访问LINUX工作站上的文件,也就是他们之间如何共享拷贝文件?
|
关于linux和windows通过网上邻居互相访问:
//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配置(smb.conf)
1.文件格式说明:
整个文件有如干个段和多个参数构成. 每个段开头是方括号([ ])括起来的段名, 结束于smb.conf文件的下一个段开头或文件尾.
文件是以一个个行为基本单位的. 每个行除了是段名或注释行外格式全为:name=value. 并且文件里段名和变量名(name)不分大小写.
以'#'或';'开头的行为注释行.等号前后的空格是忽略的.但每一行开头和结尾的空格是不可靠的,最好不要.变量值(value)里的空格赋值给变量(name)
若一行以''结尾则表明此行未完,下一行继续此行.
变量值(value)要么是字符,要么是逻辑值yes/no, true/false, 1/0
2.一般配置说明:
看这一段代码:
[share]
path = /home/guest
writeable = true
这就把你的目录/home/guest作为share共享给大家.即别人在网上邻居里看到你的计算机的share目录,内容是/home/guest下的.并且此目录可写.
再看这一段:
[doc]
path = /home/pub
writeable = false
printable = true
guest ok = true
让大家可以以guest身份看到你的目录/home/pub目录的内容,并且可写也可打印其内容.当然共享名为doc了.
还可以把你的打印机共享给大家:
[printers]
path = /usr/spool/public
guest ok = yes
printable = yes
再看这一段:
[zhoulifa]
comment = zhoulifa's Printer
valid users = zhoulifa
path = /home/zhoulifa
printer = zhoulifa_printer
public = no
writable = no
printable = yes
这一段有了zhoulifa一个共享目录,此目录只允许zhoulifa访问,并且可打印.
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(我的Linux下的Samba服务器)
# 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
# This one is useful for people to share files
[guest]
comment = Temporary file space
path = /guest
read only = no
public = yes
/****************************************************************/
//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帮助吧.
//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配置(smb.conf)
1.文件格式说明:
整个文件有如干个段和多个参数构成. 每个段开头是方括号([ ])括起来的段名, 结束于smb.conf文件的下一个段开头或文件尾.
文件是以一个个行为基本单位的. 每个行除了是段名或注释行外格式全为:name=value. 并且文件里段名和变量名(name)不分大小写.
以'#'或';'开头的行为注释行.等号前后的空格是忽略的.但每一行开头和结尾的空格是不可靠的,最好不要.变量值(value)里的空格赋值给变量(name)
若一行以''结尾则表明此行未完,下一行继续此行.
变量值(value)要么是字符,要么是逻辑值yes/no, true/false, 1/0
2.一般配置说明:
看这一段代码:
[share]
path = /home/guest
writeable = true
这就把你的目录/home/guest作为share共享给大家.即别人在网上邻居里看到你的计算机的share目录,内容是/home/guest下的.并且此目录可写.
再看这一段:
[doc]
path = /home/pub
writeable = false
printable = true
guest ok = true
让大家可以以guest身份看到你的目录/home/pub目录的内容,并且可写也可打印其内容.当然共享名为doc了.
还可以把你的打印机共享给大家:
[printers]
path = /usr/spool/public
guest ok = yes
printable = yes
再看这一段:
[zhoulifa]
comment = zhoulifa's Printer
valid users = zhoulifa
path = /home/zhoulifa
printer = zhoulifa_printer
public = no
writable = no
printable = yes
这一段有了zhoulifa一个共享目录,此目录只允许zhoulifa访问,并且可打印.
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(我的Linux下的Samba服务器)
# 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
# This one is useful for people to share files
[guest]
comment = Temporary file space
path = /guest
read only = no
public = yes
/****************************************************************/
//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帮助吧.
|
安装设置samba
|
1、用samba,Linux已经带了。
2、用ftp
2、用ftp