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