sambaforlinux
⑴ linux下samba的安装和配置
没有装 smb
samba-client-3.0.33-3.14.e15: 这个是客户端
samba-common-3.0.33-3.14.e15:这个是提供smb的主配置文件smb.conf和smb的支持命令 比如testparm等命令,该命令是检测smb的语法的
samba-3xxxxx:的这个就是服务器端了
你在rhel5光盘中找一下按上就可以了
rpm -ivh /路径/samba-3命令补全 回车就可一了
所以你虽然修改了配置,但是在/etc/init.d/smb start 的时候无法识别smb 就是因为没有装smb的服务端,服务端里面有启动脚本,logrotate设置文件等很多smb运行时需要的的东西
就像我有一部车,但是车里没有发动机,就是这个概念
有不懂的再问
⑵ Linux如何搭建samba服务
主配置文件:
/etc/samba/smb.conf
#=================== Global Settings===============
[global]部分设置,主要就是下列几项,其余可以保持不变,当然你要比较复杂高级的功能服务的话,那就另当别论了;
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = MSHOME #主机所属工作组名称
# server string is the equivalent of the NT Description field
server string = Samba Server #SAMBA服务器主机的注释,可选,但是建议还是留着,而且尽量写的详细准确,有助于识别;
# Security mode. Most people will want user level security. See security_level.txt for details.
security = share #安全模式,由于是共享目录,所以用share;
#==================== Share Definitions ==========
共享部分设置其它保存不动,直接在最后面添加你要共享的目录即可,同时要注意其访问权限;
[nfs]
path = /var/nfs
public = yes
writable = yes
/var/nfs目录对所有用户都可读可写;
四、启动服务
通过以上简单的设置,重启服务后,即可在Windows下在网上邻居中进行访问;
在FC5下,服务名为smb及nmb,启动smb时自动将nmb也启动;
五、注意事项
1、防火墙问题
2、确保共享目录的访问权限
3、通过网上邻居访问相应共享目录前,必须确保目录在服务器上存在。
范本:vi /etc/samba/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 = WORKGROUP
netbios name = rayman_linux
# server string is the equivalent of the NT Description field
server string =Linux Samba Server TestServer
# 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 indivially 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, cups
printing = cups
# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
guest account = detack
# 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 = share
# Use password server option only with security = server
# The argument list may include:
# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
# password 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 is needed to keep smbclient from spouting spurious errors
# when Samba is built with support for SSL.
; ssl CA certFile = /usr/share/ssl/certs/ca-bundle.crt
# 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*password* %n\n *Retype*new*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
# You can use PAM's password change control flag for Samba. If
# enabled, then PAM will be used for password changes when requested
# by an SMB client instead of the program listed in passwd program.
# It should be possible to enable this without changing your passwd
# chat parameter for most setups.
pam password change = yes
# 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
# This parameter will control whether or not Samba should obey PAM's
# account and session management directives. The default behavior is
# to use PAM for clear text authentication only and to ignore any
# account or session management. Note that Samba always ignores PAM
# for authentication in the case of encrypt passwords = yes
obey pam restrictions = yes
# Most people will find that this option gives better performance.
# See speed.txt and the manual pages for details
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 = no
# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
; os level = 33
# 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 = %m.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
# 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 = 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
#============================ 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
# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
; path = /usr/local/samba/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/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 = /home/detack/app/tomcat
public = yes
browseable = yes
writable = yes
printable = no
guest ok = yes
# 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
⑶ samba能实现linux与linux系统之间的文件共享吗
可以,Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成。SMB(Server Messages Block,信息服务块)是一种在局域网上共享文件和打印机的一种通信协议,它为局域网内的不同计算机之间提供文件及打印机等资源的共享服务。SMB协议是客户机/服务器型协议,客户机通过该协议可以访问服务器上的共享文件系统、打印机及其他资源。通过设置“NetBIOS over TCP/IP”使得Samba不但能与局域网络主机分享资源,还能与全世界的电脑分享资源。
Linux可作为samaba服务器由windows客户端访问共享文件,这与Windows访问其它Windows计算机的方式是相同的协议。
如果访问samba服务器或Windows服务器共享文件的客户机是个Linux系统,可使用客户端软件smbclient,语法如下:
smbclient [网络资源][密码][-EhLN][-B<IP地址>][-d<排错层级>][-i<范围>][-I<IP地址>][-l<记录文件>][-M<NetBIOS名称>][-n<NetBIOS名称>][-O<连接槽选项>][-p<TCP连接端口>][-R<名称解析顺序>][-s<目录>][-t<服务器字码>][-T<tar选项>][-U<用户名称>][-W<工作群组>]
参数:
[网络资源] [网络资源]的格式为//服务器名称/资源分享名称。
[密码] 输入存取网络资源所需的密码。
-B<IP地址> 传送广播数据包时所用的IP地址。
-d<排错层级> 指定记录文件所记载事件的详细程度。
-E 将信息送到标准错误输出设备。
-h 显示帮助。
-i<范围> 设置NetBIOS名称范围。
-I<IP地址> 指定服务器的IP地址。
-l<记录文件> 指定记录文件的名称。
-L 显示服务器端所分享出来的所有资源。
-M<NetBIOS名称> 可利用WinPopup协议,将信息送给选项中所指定的主机。
-n<NetBIOS名称> 指定用户端所要使用的NetBIOS名称。
-N 不用询问密码。
-O<连接槽选项> 设置用户端TCP连接槽的选项。
-p<TCP连接端口> 指定服务器端TCP连接端口编号。
-R<名称解析顺序> 设置NetBIOS名称解析的顺序。
-s<目录> 指定smb.conf所在的目录。
-t<服务器字码> 设置用何种字符码来解析服务器端的文件名称。
-T<tar选项> 备份服务器端分享的全部文件,并打包成tar格式的文件。
-U<用户名称> 指定用户名称。
-W<工作群组> 指定工作群组名称。
⑷ linux下安装SAMBA服务
1.安装第1块光盘。Rpm -qa|grep sambaMount /mnt/cdrom Cd /mnt/cdrom/RedHat/RPMS/Rpm -ivh samba-common-2.2.7a-7.9.0.i386.rpmRpm -ivh samba-2.2.7a-7.9.0.i386.rpmRpm -ivh samba-client-2.2.7a-7.9.0.i386.rpm Rpm -ivh redhat-config-samba-1.0.4-1.noarch.rpmCd;eject;2.安装第3块光盘.Mount /mnt/cdromRpm -ivh samba-swat-2.2.7a-7.9.0.i386.rpmCd;eject;3.修改配置文件。Vi /etc/samba/smb.conf修改工作组:workgroup=WORKGROUP修改Samba server name : Samba String =Linux 或者Samba String=Samba String %v at %hNetbios name =LuXu Linux设置安全级别:security =share(access no need password) / if security = user(access need user password)4.在文件最后添加共享文件。把光标移动到/etc/samba/smb.conf最后。然后输入:[mp3]Path = /mp3Public = yesWritable =yes5.在目录/下创建/mp3目录,并且赋予最大权限。Cd /rootCd /Mkdir /mp3Cd /mp3Ls Chmod 777 /mp36.service iptables stop7.Service smb start8.test :在Windows XP中打开“网上邻居”,写上ip:\\192.168.1.11访问 success!
⑸ Linux系统怎么搭建Samba共享服务器
方法/步骤
1
需要检查linux是否已安装samba;
检查命令为:rpm –qa |grep samba;
如果没有输出什么信息,表明没有安装,需要到网络下载安装,下载如下:
2
以下可以看到我的linux系统有安装samba,可以进行下一步;
建立共享文件夹,命令如下:
Mkdir /home/fileshare;
如下图:
如下图,已建立好文件夹;
设置好文件夹权限,命令如下:
Chmod 755 fileshare;
建立samba用户;
Groupadd fileshare
Useradd –s /sbin/nologin file
Smbpasswd –a file
注意:访问共享的用户必须为samba用户,不能使用其他用户;
修改sambe配置文件;命令如下:
Vim /etc/samba/smb.conf;
修改samba配置文件全局设置;
#==============================Global settings===============
[global] workgroup = WORKGROUP server string = Samba Server security = share
设置文件夹共享,如下:
[sharefile] path = /home/sharefile public = yes read only = yes
重启smb服务;
Service smb restart;
Windows 访问共享成功。如下:
linux共享服务器完美架设,下次会继续和大家分享linux其他经验。
⑹ linux怎么配置samba服务器
linux系统下配置samba服务器过程:
首先需要登入安装了Linux系统的计算机,安装Samba。Fedora发行版一般使用yum工具安装Samba服务器,可以使用“rpm -q samba”查询Samba服务器是否已经安装,当然,也可以直接使用“yum install samba”安装Samba服务器。如果Samba已经安装,yum会给出提示,否则按照步骤,输入“y”就可以直接下载安装Samba服务器了。
安装完成之后,需要查看一下Samba是否已经加入到自启动服务。使用“/sbin/chkconfig | grep smb”和“/sbin/chkconfig | grep nmb”命令可以查看smb和nmb是否加入到系统服务。(SMB是Samba共享服务,nmb是NetBIOS服务,为配合Windows使用,他们两个服务都要加入到系统服务中)。然后再使用“/sbin/service smb status”和“/sbin/service nmb status”查看服务是否已经启用。
接下来就要配置samba服务器了。编辑修改“/etc/samba/smb.conf”,设置共享和认证参数。如图就是我在用的Samba用户共享典型配置文件。编辑修改完成之后,可以使用“testparm /etc/samba/smb.conf”验证配置文件的有效性,以免因配置文件错误而导致Samba服务无法启动。
验证OK的话,接下来就是添加Samba共享用户了,使用“/usr/bin/smbpasswd -a <用户名称>”的方式添加Samba共享用户,并为每个用户设置Samba共享认证的密码。
到这里基本上Samba服务器配置就完成了,如果上述步骤中smb和nmb服务没有自动添加到系统服务中,可以使用“/sbin/chkconfig --level 2345 smb on”和“/sbin/chkconfig --level 2345 nmb on”将其加入到系统服务中,其中2345是Linux的运行级别,一般都不会超出这几个运行级别。然后我们就可以使用“/sbin/service smb restart”和“/sbin/service nmb restart”重启服务了。
重启完成之后,Windows就可以访问用户共享了。在Windows资源管理器输入“\共享IP地址共享用户”,就可以访问用户自己目录下的全部文件了。
为了测试共享权限,我们进入用户共享目录,尝试在Windows资源管理器中创建一个“test”目录。
回到Linux的用户目录,我们就可以看到,Windows和Linux查看到的用户共享目录是一致的。(你可能觉得看到的文件和目录说不一致,这是因为我的Windows设置了显示隐藏文件和文件夹的缘故。)
图解过程:http://jingyan..com/article/6525d4b1517671ac7d2e94e8.html
给个采纳吧!!!
⑺ 在linux系统上如何创建samba账号
1)建一个系统用户
[root@linux samba]# useradd samba (建一个名叫samba的用户)
[root@linux samba]# passwd samba (给samba用户添加密码)
Changing password for user samba.
New password: (密码要六位以上,不显示在屏幕上)
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new password: (确认密码)
passwd: all authentication tokens updated successfully.
2)然后创建samba帐户
[root@linux samba]# smbpasswd -a samba
(-a必须加,为了生成密码文件smbpasswd,该密码是windows登陆Linux的samba用户密码)
New SMB password:
Retype new SMB password:
unable to open passdb database.
Added user samba.
3)查看一下生成的用户名、密码
[root@linux samba]# vi /etc/samba/smbpasswd
samba:500:::[UX ]:LCT-468268E6:
4)重新启动samba服务
[root@linux samba]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
⑻ Linux下如何搭建SAMBA服务器
1、相关的文件
samba-common samba服务器的主文件
samba 服务器端的软件
samba-client 客户端的软件
redhat-config-samba 图形界面的配置文件
samba-swat web配置工具
2、步骤
1)安装SAMBA服务器
(1)检测是否安装samba
#rpm -qa | grep samba
(2)安装:将第一张光盘放入光驱
#mount /mnt/cdrom
#cd /mnt/cdrom/RedHat/RPMS
#ls samba*.*
#rpm -ivh samba-common-2.2.7a-7.9.0.i386.rpm
#rpm -ivh samba-2.2.7a-7.9.0.i386.rpm
#rpm -ivh samba-client-2.2.7a-7.9.0.i386.rpm
#cd /
#umount /mnt/cdrom
#eject
2)设置samba的密码文件
(1)成批用户密码文件的生成
#cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd
(2)删除一些无用的shell帐户
#vi /etc/samba/smbpasswd
从1到9。
(3)设置目录和文件的权限
#chown root.root /etc/samba/smbpasswd
#chmod 500 /etc/samba
#chmod 600 /etc/samba/smbpasswd
#ll -d /etc/samba
(4)单个用户设置samba密码
#useradd wujianan
#passwd wujianan
#smbpasswd -a wujianan
3)启动samba服务器
#service smb start
#pstree | grep mbd
#smbclient -L localhost或者IP地址
4)配置samba的共享
#vi /etc/samba/smb.conf
[global]
workgroup = workgroup
server string = samba server
;hosts allow = 192.168.1. 192.168.2. 127.
printcap = /etc/printcap
load prints = yes
printing = cups
;guest account = pcguest
log file = /var/log/samba/%m.log
max log size = 0
安全选项
security = user(share)
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
;interfaces = 192.168.12.2/24 192.168.13.2/24
dns proxy = no
设置每个用户主目录共享
[homes]
comment = Home Directries
browseable = no 不允许浏览共享文件夹
writeable = yes 允许写入
valid users = %s
create mode = 0664
directry mode = 0775
[printers]
comment = All prints
path = /var/spool/samba
browseable = no
printable = yes
[doc]
comment = doc
path = /home/doc
browseable = no
writeable = no或 read only = yes
guest ok = yes
示例:
要求:创建一个共享目录,所有用户都可访问,权限为只读。
#vi /etc/samba/smb.conf
workgroup = workgroup
server string = samba server
netbios name = RH9
dos charset = cp936
unix charset = cp936
secrity = share
[read]
comment = read
path = /home/read
public = yes
guest ok = yes
read only = yes
保存退出
#mkdir /home/read
#service iptables stop
#service smb start
#testparm
\\ip地址
创建一个可写的目录,允许所有用户可写入。
[write]
comment = write
path = /home/write
public = yes
guest ok = yes
writeable = yes
保存退出
#mkdir /home/write
#chmod 777 /home/write
#service iptables stop
#service smb restart
为指定的用户和组访问samba服务器
#useradd mehost
#passwd wujianan
#smbpasswd -a wujianan
#mkdir /var/samba/wujianan
#chown stu1.stu1 /var/samba/wujianan
#vi /etc/samba/smb.conf
security = user
[wujianan]
comment = wujianan
path = /var/samba/wujianan
valid users = wujianan
public = yes
writeable = yes
保存退出
#service smb restart
最简单的电影服务器的配置
#vi /etc/samba/smb.conf
workgroup = workgroup
server string = movies server
guest account = nobody
security = share
client code page = cp936
wins support = yes
[movies]
comment = movies
browseable = yes
writeable = no
path = /movies
guest ok = yes
read only = yes
保存退出
#mkdir /movies
#useradd admin -d movies
#passwd admin
#vi /etc/passwd
admin:x:0:500::/movies:/bin/bash
保存退出
#ntsysv
选择smb和vsftp项
#service smb start
#service vsftpd start
#service iptables stop
⑼ Linux下安装samba服务
samba的帐户设置有点特别,它使用的是系统的帐户,但是要把账户映射到samba的帐户数据库,而且要设置samba密码才能使用。因此你的oracle账户需要在系统中先建立起来,至于系统账户密码,如果该账户只用于samba访问,可以不设置系统密码,而只为账户设置samba的密码。建议你这样试试:
useradd oracle
smbpasswd -a oracle