搜档网
当前位置:搜档网 › Solaris10配置samba_服务

Solaris10配置samba_服务

Solaris10配置samba_服务
Solaris10配置samba_服务

Solaris 10 配置samba 服务

一、samba 简介

Samba提供了Unix系统和Windows之间的文件和打印机共享服务。一台Solaris的机器,如果配置了Samba Server,就能充当共享服务器;同时也能作为客户机访问网络中其它Windows系统上的共享文件,或其它安装了Samba Server的Solaris/Linux系统上的共享文件。

SolarislO在系统安装的时候就已经包含了Samba,只需要简单的配置就可以成为Samba Server。

Samba服务器包含两个Daemon, nmbd和smbd。smbd是samba的内核,是建立对话,验证客户和提供文件系统和打印服务的基础;nmbd则处理所有的名字注册和解析请求,实现了网络浏览的功能;它的任务是向局域网广播Samba服务器所提供的服务;Nmbd使得Samba服务器显示在windows操作系统的网络邻居中,允许用户浏览可以通过samba使用的资源。

Solaris10自带samba,但samba服务为遗留服务,新安装solaris中未被启用

使用命令ps -ef | grep mbd,可查看samba进程samba在solaris10中的一些目录

、配置samba无用户验证方式

1. 创建共享目录

mkdir -m 777 -p /export/home/smbshare

2. 创建samba配置文件

cp /etc/sfw/smb.c on f-example /etc/sfw/smb.c onf

3. 编辑/etc/sfw/smb.conf 文件

a. 将security = user 改为security = share

连接模式,share为共享模式,不需要用户验证。user和server方式需要用户验证

b. . log file = /var/samba/log/log.%m 定义了log的默认路径,可自行定义log路径

c. max log size = 50 定义了log文件默认大小,单位Kb

d. 修改共享文件路径信息

将原有信息

#======== Share Defin iti ons ==========

[homes]

comme nt = Home Directories

browseable = no

writable = yes

修改为

Share Defi niti ons

[homes]

comme nt = Home Directories 三、配置user (用户验证)方式

配置成user 方式是需要提供用户明和密码进行验证的。这要比 share 方式的不验证相

比较会更安全。其配置方式与配置 share 方式基本上是一致的。只是在 smb.conf 文件中的 security =

share 方式变成了 security = share

然后添加samba 用户,用户可以是已有用户,也可以是即将新建用户

-bash-3? 00# /usr/sfw/b in/smbpassvd -a root New SMB password:

Retype new SKB password: Added user root*

-bash-3.00# /usr/sfw/bin/smbpasswd root

Enabled user root,

-bash-3, 00? svc acbu rest art samba

添加用户并重启samba 服务后,使用windows 访问即会被要求输入用户密码 若要对不同用户的共享目录进行权限限制可按如下配置

smb.conf 文件

===== ===== /usr/sfw/smb.c onf ========== security = user [homes]

comme nt = Home Directories for %S valid users = %S

browseable = no writable = yes create mask = 0640 directory mask = 0750

1.

此处使用root 用户作为共享用户,仅为测试所用,实际生产环境或公共用

e. f.

browseable = yes writable = yes path = /expore/home/smbshare guest ok = yes 启动samba 服务 svcadm en able samba 查看samba 服务 ps -ef | grep mbd -bash-3,

OOit ps root 10935 root 10935 root 10941

#共享目录路径

-ef

10935 1 10935 grep nbd 0 11:16: 18 0 11:16: 18 0 11:16:56 ■

? ?

0:00 0:00 0:00 /usr/sfw/sbirt/smbd

-D /usr/sfw/sbirt/smbd -D

/usr/sfw/sbin/smbd -D

g.

在 windows 上可用 IP 访问 solaris

#只有所有者能访问该共享 #该共享对其它用户不可见 #创建文件时的权限掩码,权限为

rw-r ——

#创建目录时的权限掩码,权限为rwx-r-x---

机,应

使用其他用户,不可使用root用户。

2. 这里%S通配符可以扩展成实际的共享名。这样root用户共享的注释将是“Home

Directories for root ”。

3. 此处未定义"path”,每个用户的共享目录为该用户在solais内的home目录内,通

常为"/export/home/username",root用户则为根目录"/”,因此使用root用户为文件共享

用户,对系统安全有极大威胁

四、解决共享文件夹在windows下新建文件名不能为中文的问题

在smb.conf 的[global] 节,加上:

un ix charset = GBK

dos charset = GBK

display charset = GBK

即可

smb.conf 范例

二二二二 1 二二二二二二Global Sgttirig g 二二二二二二二二二二二二——二二二二

[global]

workgroup = MYtROUP

server string = Samba Server

security = user

load printers = yes

log file = /var/samiba/log/log^ %it

max log size 二50

passdb backend = smbpasswd

dns proxy = no

unix charset = GEE

dos charset = GEK

display charset = GBK

#=====================-=== Share Definitions ==========================

[hone^J

comnent = Honbe Directories f cr %S

browse^ble = no

writ able = yes

guest ok = yes

valid users =

create mask = 0640 directory mask = 0750

五、Solaris 访问Windows共享资源

1. 查询网络上的Samba服务器

# /usr/sfW/b in/fin dsmb

每个找到的服务器都会显示其IP地址、NetBIOS名称、工作组名称、操作系统、

以及SMB服务器版本。

2. 列出Samba服务器上的可用资源

# /usr/sfw/b in/smbclie nt -L

如果是user共享方式,就要加"-U ”选项如下。

# /usr/sfw/b in/smbclie nt -L

Password:

如果是share共享方式,可以不必理会用户和密码,要求输入密码时直接回车即

可。

3. 连接Samba共享

# /usr/sfw/b in/smbclie nt /// [-U

例如要访问上文中的share共享时,可用

# /usr/sfw/b in/smbclie nt //host name/homes

-bash-3. 00# /usr/sfw/bin/smbclient //10, 39.101. 27/-temp

Password:

Domain= [QYY] 0S= [Windows 5*1] Server= [Windows 2000 LAJI Manager]

siab: \>

要访问上文中的user共享时,可用

# /usr/sfw/b in/smbclie nt //hos tn ame/username -U user name

Password: < user name_password>

Domai n=[MYGROUP] OS=[U nix] Server=[Samba 3.0.25a]

smb:>

-bash-3. 00# /iur/sfi/b w snbc 11 ent /flu. 3B. 102. 20D/root -U root Password; Domain^[SOLARISTEST] OS-[Unix] Server=[Samba 3. 0* 25a] sub: \> Is V ■

Last+found Tue J an 3 Tue Jan 8

Fri Dec 21 10 10 09

28 28 enport net var usr

D D R D D

0 Fri Dec 21 09: 0 Tue Jan 8 09:

0 Fri Dec 21 13: 0 Fri Dec 21 10:

8

6 4 7o o _u an an ec J -J D e e l 1

8 8 1

2

- 2mnt D

0 Fri Dec 21 09 38 opt D 0 Fri Dec 21 10 01 proc DR 0 Tue J an 3 16 51 sb in D 0 Fri Dec 21 09 52 sy st ent D 0 Fri Dec 21 09 38 tmp D □ Tue J an 3 134 platform D 0 Fri Dec 21 09 53 boot D 0 Fri Dec 21 10 13 devices D 0 Tue Jan 3 09 25 kernel

D 0 Fri Dec 21 09 59 hojiie

DR □ Tue J an .sunw DH 0 Fri Dec vol DR 0 Tue Jan cdrom D 0 Tue Jan * dt

DH 0 Fri Dec ? dt profile AH 5111 Fri Dec * gnome DH 0 Fri Dec .K authority H 105 Fri Dec .gnome 2

DH 0 Fri Dec .gnojne2_pr ivat e DH 0 Fri Dec * gconf DH 0 Fri Dec * gconfd

DH 0 Fri Dec * softwareupdate DH 0 Fri Dec Documents D 0 Fri Dec 8 21 21 21 21 21 21 21 21 21 21 21 09: 10:

09:

09: 13: 13: 13: 13: 13: 13:

13: 14: 13: 13: 26 20 26 26 14 14 14 14 14 14 14 IT 14 14 .I 匚E authority H 447 Fn Dec 21 13 14

.met acity

DH 0 Fri Dec 21 13 14 .gtkrc-1. 2-gnone2 H 77 Fri Dec 21 13 14 .naut ilus DH 0 1-ri Dec 21 13: 14 Desk!op

D 0 Fri Dec 21 1:U ? cecently-used

H 0 Fri Dec 21

14

DH 0 Fri Dec 21 13 27 smbshare D

0 Tue Jan 3 14 40 34176 blocks of size 524288.

sub: \> ||

14 2006

14 2008 27 2007 39 2007 21 2008 42 2007

05 2007 62 2007 39 2008 39 2008

13 2007

45 2007 34 2007 28 200E 20 2007 45 2007 15 2008 52 2007 12 2007 39 2008 55 2007

21 200B 12 2007 28 2008 34 2008 23 2007 22 2007

46 2007 10 200? 55 2007

33 2007 56 2007 04 2007 43 2007 51 2007

37 2007

51 2007 46 2007 57 2007 58 2007 57 2007 24 2007 47 2008

Z6J15 blocks available

连接后,就能象FTP 用户一样上传和下载文件。 用put 表示上传,用get 表示下

载。键入help 获得可用的命令列表。

由kinney 收集网络资料并编写

相关主题