導航:首頁 > IDC知識 > redhatsamba伺服器

redhatsamba伺服器

發布時間:2020-11-14 05:05:24

1、如何在RedHat中安裝samba

mount 安裝光碟,配置好yum源到安裝光碟所在目錄,例如/mnt: vi /etc/yum.repos.d/local.repo 配置如下: [Server] name=Server baseurl=file:///mnt/ gpgcheck=0 enabled=1 執行yum安裝: yum install samba*

2、如何在RedHat中安裝samba

(1)運用rpm -qa |grep samba查看本計算機中是否以及安裝了samba的哪些包。[root@server1 Server]# rpm -qa |grep samba
samba-common-3.0.25b-0.el5.4 samba-3.0.25b-0.el5.4samba-client-3.0.25b-0.el5.4
(2)運用rpm安裝相關的samba的所有包,如果安裝過就不要再安裝了。
[root@server1 Server]# rpm -ivh samba-common-3.0.25b-0.el5.4
[root@server1 Server]# rpm -ivh samba-3.0.25b-0.el5.4[root@server1 Server]# rpm -ivh samba-client-3.0.25b-0.el5.4
(3)用vim打開samba的配置,並對其內相關內容進行編輯和修改[root@server1 Server]# vim /etc/samba/smb.conf

3、在linux redhat 5中如何設置samba伺服器,如何與windows實現訪問?

一.搭建基本共享文件,匿名訪問:
1.備份smb.conf文件,出現問題好恢復:
[root@epro samba]# cp -p smb.conf smb.conf.bak
2.編輯smb.conf文件
[root@epro samba]# gedit smb.conf
在---------Standalone Server Options----------這條語句下面
修改:
security = share
passdb backend = tdbsam
默認是沒有/etc/samba/smbpasswd文件,在Standalone Server Options加上下面這句就有了:
smb passwd file = /etc/samba/smbpasswd

默認的security = user(需要系統賬戶訪問) 改為security = share (可以使用匿名訪問)
在----------Share Definitions---------- 這條語句下面
添加:
[share]
comment = share of test
public = yes
path = /mnt/abc
writable = yes
printable = no
解釋:
[share] ——伺服器共享文檔名稱
comment = share ——伺服器說明
path = /mnt/abc ——共享文檔的路徑
publice = yes ——允許匿名訪問
writable = yes ——允許寫入(前提是目錄本身有其他用戶寫入的許可權)
printable = no —— 並非列印機
3.建立共享文件夾
[root@epro ~]# mkdir /mnt/abc //創建文件夾abc
[root@epro ~]# cd /mnt
[root@epro mnt]# chmod 1777 abc //修改abc文件夾的許可權為777,設置冒險位為1
設置冒險位作用:目的是用戶a在共享目錄裡面寫入文件,那麼用戶b登陸看到之後只能讀取卻不能刪除,起到了防止用戶誤刪除其他用戶的文件
4.重新啟動samba服務
[root@epro abc]# service smb restart
[root@epro abc]#chkconfig --level 3 smb on //運行級別3自動載入
也可以用ntsysv,圖形化設置自動運行
5.用windows去訪問SAMBA共享文件:
\\192.168.0.14\share

以上為個人實驗後寫下的筆記,都是純手工輸入的。。。。

4、redhat enterprise 如何配置samba伺服器

/etc/samba/smb.conf主配置文件,此文件中有豐富的說明注釋
使用smbpasswd命令使Linux系統用戶成為Samba用戶,命令格式如下:
smbpasswd –a 用戶名

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 many any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = Workgroup ;計算機所在的工作組名或域名
netbios name = fileserver ;即在,網上鄰居中顯示的計算機名
# server string is the equivalent of the NT Description field
server string = Samba Server ;計算機描述

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. ;允許訪問的計算機的IP地址
; hosts allow = 172.16.0. 172.16.3. 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 = no是否將列印機共享

# 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 = cups一種列印驅動模式,即LINUX支持的標准列印類型。其LINUX支持的列印類型有bsd, sysv, plp, lprng, aix, hpux, qnx

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = nobody
guest account = guest ;允許訪問(不需要用戶名與密碼)也可以指定任何系統內置的一個帳號做為來賓帳號。
# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/%m.log.會給用戶在此目錄下做每個SAMBA用戶登錄的日誌。

# Put a capping on the size of the log files (in Kb).
max log size = 50日誌 文件限制在50K內

# Security mode. Most people will want user level security. See
# security_level.txt for details.
security = share
; security = user
# Use password server option only with security = server
; password server = <NT-Server-Name>此行的作用為如果上面的選項為SERVER,則SAMBA伺服器在做身份識別的時候,把WIN機器發過來的密碼同用戶名交給此項設定的密碼伺服器驗證。

# Password Level allows matching of _n_ characters of the password for
# all combinations of upper and lower case.
; password level = 8
; username level = 8(對於從前的幾款老式的WINDOWS系統對於大小寫密碼支持的不是很好,所以開啟上面的兩個參數的意義是在密碼為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(加密明文的SAMBA密碼進行發送)
smb passwd file = /etc/samba/smbpasswd驗證密碼所在的目錄

# The following are needed to allow password changing from Windows to
# update the Linux sytsem 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.
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
; wins support = yes把該伺服器配置為WINS伺服器

# 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 = 192.168.1.100也可以指定一個WINS伺服器,讓自己成為WINS客戶

# 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
(整個上面這段為討論與WINDWOS文件系統的大小寫問題因為微軟的系統是一個大小寫不區分 的系統,默認用默認值即可。因為修改可能造成與WINDOWS的不兼容問題)

#============================ Share Definitions ==============================
[homes]作為登錄用戶,自己訪問自己目錄的設置。
; comment = Home Directories目錄說明
; browseable = no用戶私人目錄不需要給別人瀏覽。
; writable = yes也可以用read only=no來替代

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]域用戶登錄目錄設置。
; comment = Network Logon Service
; path = /home/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 = /home/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/soft
public = yes
guest ok = yes以上兩個public=yes代表來賓帳號能訪問此共享目錄,但guest ok代表密碼不是必須的,可以不加。
writable = yes
printable = no
write list = @staff此參數告訴我們不必要讓所有人訪問共享目錄,可以有staff這個組的成員能訪問,但在passwd和shadow文件中要存在這個組。

# 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 = /homes/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] (為創建一個私有目錄,別人都不能訪問,只有fred這個用戶能訪問)
; 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/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

最後建議在圖形界面配置比較簡單
在LINUX提示符下輸入startx
即可進入圖形界面 和WINDOWS差不多 窗口化的配置比較直觀也比較簡單

5、在RHEL7中 samba伺服器默認的身份驗證方式是什麼?

設置用戶訪問Samba Server的驗證方式,一共有四種驗證方式。默認是第一種。

share:用戶訪問Samba Server不需要提供用戶名和口令, 安全性能較低。

2. user:Samba Server共享目錄只能被授權的用戶訪問,由Samba Server負責檢查賬號和密碼的正確性。賬號和密碼要在本Samba Server中建立。SAMBA文件共享服務

3.server:依靠其他Windows NT/2000或Samba Server來驗證用戶的賬號和密碼,是一種代理驗證。此種安全模式下,系統管理員可以把所有的Windows用戶和口令集中到一個NT系統上,使用Windows NT進行Samba認證, 遠程伺服器可以自動認證全部用戶和口令,如果認證失敗,Samba將使用用戶級安全模式作為替代的方式。

4.domain:域安全級別,使用主域控制器(PDC)來完成認證。

6、redhat怎麼訪問linux系統smb

在Linux系統中訪問Samba伺服器中的共享目錄需要使用smbclient命令,當然首先得在對應Linux系統主機中安裝Samba服務的客戶端軟體--smbclient。使用smbclient -L命令(有關smbclient命令的詳細選項可通過smbclient -help命令查看)可以查看指定Samba伺服器上的所有共享目錄。如要瀏覽本示例中Sambaserver上的共享目錄,可以在終端提示符下輸入以下命令:
smbclient -L Sambaserver

在出現提示輸入密碼時,直接按Enter鍵(因為此處是匿名訪問),結果會顯示指定Samba伺服器上當前全部的共享目錄,
使用共享目錄的命令格式為:smbclient //IP地址或主機名/共享目錄名 -U用戶名。
因為此處是匿名訪問,所以無須加上"-U"選項來指定訪問的用戶名。如在此要匿名訪問Sambaserver上的doc目錄,則可以在終端提示符下輸入以下命令:

smbclient //Sambaserver/doc

在出現輸入密碼的password提示符時,直接按Enter鍵,即進入到遠程使用伺服器上指定資源的提示符smb:\>,與FTP客戶端相似,這時可以使用如cd、cat、get等命令對共享目錄和文件進行操作了。注意,這個命令不僅可以訪問Samba伺服器上的共享資源,還可以訪問網路中Windows主機上的共享資源。

7、redhat 7.0怎麼開啟samba

安裝samba包
yum install samba

查看Samba配置文件
cat/etc/samba/smb.conf

使用Samba服務口令驗證方式可以讓共享文件更加的安全,做到僅讓信任的用戶訪問,而且驗證過程也很簡單,要想使用口令驗證模式,我們需要先創建Samba服務獨立的資料庫。
第1步:檢查當前是否為user驗證模式。
[root@linuxprobe ~]# cat /etc/samba/smb.conf

第2步:創建共享文件夾:
[root@linuxprobe ~]# mkdir /database

第3步:描述共享文件夾信息。
在SMB服務主配置文件的最下面追加共享文件夾的配置參數:
[database]
comment = Do not arbitrarily modify the database file
path = /database
public = no
writable = yes
保存smb.conf文件後重啟啟動SMB服務:
[root@linuxprobe ~]# systemctl restart smb

添加到開機啟動項:

具體詳細步驟查看http://www.linuxprobe.com/chapter-12.html#1221

8、redhat7.0 在配置samba伺服器出現問題 samba伺服器啟動不了

不好意思貌似你的samba軟體沒有安裝成功或者說沒有安裝正確,建議重新安裝,然後再試一下,不行再留言給我

9、如何在RedHat中安裝samba

1、檢查Samba服務包是否已復安裝

#rpm -qa | grep samba
    samba-3.5.4-68.el6.x86_64
    samba-common-3.5.4-68.el6.x86_64
    samba-client-3.5.4-68.el6.x86_64
    samba4-libs-4.0.0-23.alpha11.el6.x86_64
    samba-winbind-clients-3.5.4-68.el6.x86_64



若是以上結制果,則說明samba已經安裝,如果沒有安裝,運行下面命令安裝 :

#yum install samba

YUM安裝會自己安裝服務的依賴包 ,快捷 簡單 ,安裝前建議關閉selinux

10、用RedHat下的Linux:SAMBA 安裝架設SAMBA伺服器,實現linux和windows資源共享,要

你要共享的文件夾為: /homes

首先創建這個文件夾

mkdir /homes/

chmod 777 /homes
備份並編輯smb.conf允許網路用戶訪問
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
sudo gedit /etc/samba/smb.conf
搜尋這一行文字

; security = user

用下面這幾行取代

security = user

username map = /etc/samba/smbusers

將下列幾行新增到文件的最後面,假設允許訪問的用戶為:newsfan。而文件夾的共享名為 Share

[Share]

comment = Shared Folder with username and password

path = /homes

public = yes

writable = yes

valid users = newsfan

create mask = 0700

directory mask = 0700

force user = nobody

force group = nogroup

available = yes

browseable = yes

然後順便把這里改一下,找到[global]把 workgroup = MSHOME 改成

workgroup = WORKGROUP

display charset = UTF-8

unix charset = UTF-8

dos charset = cp936

後面的三行是為了防止出現中文目錄亂碼的情況。其中根據你的local,UTF-8 有可能需要改成 cp936。自己看著辦吧。
現在要添加newsfan這個網路訪問帳戶。如果系統中當前沒有這個帳戶,那麼

sudo useradd newsfan

要注意,上面只是增加了newsfan這個用戶,卻沒有給用戶賦予本機登錄密碼。所以這個用戶將只能從遠程訪問,不能從本機登錄。而且samba的登錄密碼可以和本機登錄密碼不一樣。

現在要新增網路使用者的帳號:

sudo smbpasswd -a newsfan

sudo gedit /etc/samba/smbusers

在新建立的文件內加入下面這一行並保存

newsfan = "network username"

如果將來需要更改newsfan的網路訪問密碼,也用這個命令更改

sudo smbpasswd -a newsfan

刪除網路使用者的帳號的命令把上面的 -a 改成 -x

sudo testparm

sudo /etc/init.d/samba restart

如果還是不行查看Iptables(防火牆是否開啟),如果開啟可以先將服務停止。

最後退出重新登錄或者重新啟動一下機器。
配置文件 /etc/samba/

//設置samba密碼文件

# cat /etc/passwd|mksmbpasswd.sh > /etc/samba/smbpasswd

//為安全起見,設置文件和目錄的許可權

# chown root.root /etc/samba/smbpasswd

# chmod 500 /etc/samba

# chmod 600 /etc/samba/smbpasswd

//為用戶設置口令

#smbpasswd root

//檢查配置文件的正確性

# testparm

//檢查伺服器所共享的資源

# smbclient –L localhost

//列出資源使用情況

# smbstatus [-b]

//配置文件

節:

l [Global] 定義全局參數和預設值

l [Homes] 定義用戶的Home目錄共享

l [Printers] 定義列印機共享

l [Userdefined_ShareName] 用戶自定義共享(可有多個)

變數:

l %S 當前服務名

l %P 當前服務的根路徑

l %u 當前服務的用戶名

l %g 給定%u的所在工作組名

l %H 給定%u的宿主目錄

l %v Samba版本號

l %h 運行服務的主機名

l %m 客戶機的NETBIOS名

l %L 伺服器的NetBIOS名

l %L 當前的日期和時間

//使用符號鏈接組織本地共享資源

# vi /etc/samba/smb.conf

[Resource]

comment = Local Resource

path = /var/samba/resource

public = yes

writeable = yes

// -p parent(no error if existing, make parent directories as needed)

# mkdir –p /var/samba/resource

#cd /var/samba/resource

//-s, --symbolic

# ln –s /usr/share/doc doc

//為所有用戶配置只讀共享和讀寫共享

# vi /etc/samba/smb.conf

[tmp]

comment = Temporary file space

path = /tem

read only = no

public = yes

[cdrom]

comment = CDROM

path = /mnt/cdrom

read only = yes

public = yes

//為指定用戶或組配置共享

# useradd samba

# passwd samba

# mkdir /var/samba/samba

//更改目錄屬主

# chown samba.samba /var/samba/samba

# vi smb.conf

[sambadir]

comment = Samba's service

path = /var/samba/samba

valid users = samba

public = no

writable = yes

//保存修改

//Linux環境下訪問Samba共享

# cat /etc/samba/lmhosts

# smbclient –L IP –U 用戶名

# smbmount //win/tools /mnt/smb/win

與redhatsamba伺服器相關的知識