您的位置:首页 > 其它

搭建samba服务器(一):初步实现在windows下访问unix资源的共享文件

2014-02-20 00:17 627 查看
搭建samba服务器(一):初步实现在windows下访问unix资源的共享文件

[root@solaris186:/]# pkginfo | grep samba //先检查系统是否安装samba软件

system SUNWsmbac samba - A Windows SMB/CIFS fileserver for UNIX (client)

system SUNWsmbar samba - A Windows SMB/CIFS fileserver for UNIX (Root)

system SUNWsmbau samba - A Windows SMB/CIFS fileserver for UNIX (Usr)

[root@solaris186:/]# pkginfo -l SUNWsmbar //查看到特定的SUNWsmbar的详细信息

PKGINST: SUNWsmbar

NAME: samba - A Windows SMB/CIFS fileserver for UNIX (Root)

CATEGORY: system

ARCH: i386

VERSION: 11.10.0,REV=2005.01.08.01.09

BASEDIR: /

VENDOR: Sun Microsystems, Inc.

DESC: samba - A Windows SMB/CIFS fileserver for UNIX (Root)

PSTAMP: sfw10-patch-x20100616080612

INSTDATE: Oct 15 2013 10:39

HOTLINE: Please contact your local service provider

STATUS: completely installed

FILES: 24 installed pathnames

13 shared pathnames

18 directories

43 blocks used (approx)

[root@solaris186:/]# svcs -v | grep samba //检查服务是否开启

maintenance - 16:55:17 - svc:/network/samba:default

[root@solaris186:/]# svcadm enable samba //开启服务命令

[root@solaris186:/]# svcs -v | grep samba //检查服务仍然没有开启

maintenance - 16:55:17 - svc:/network/samba:default

挂载光盘sol-10-u9-ga-x86-dvd.iso

[root@solaris186:/]# ls //查看根目录下是否有cdrom

Desktop export practisenew

Documents file1 proc

apache-2.2.11-sol10-x86-local.gz home sbin

apache-2.2.21-sol10-x86-local.gz kernel system

bin lib tmp

boot lost+found usr

cdrom mnt var

dev net vol

devices opt

etc platform

[root@solaris186:/]# cd cdrom //进入到cdrom下

[root@solaris186:/cdrom]# ls //查看cdrom下的内容

cdrom0 sol_10_910_x86

[root@solaris186:/cdrom]# cd sol_10_910_x86 //进入到sol_10_910_x86目录下

[root@solaris186:/cdrom/sol_10_910_x86]# ls //查看sol_10_910_x86下的内容

Copyright Solaris_10 installer

GPL_LGPL_Source_Offer.txt boot

[root@solaris186:/cdrom/sol_10_910_x86]# pkgadd -d /cdrom/sol_10_910_x86/Solaris_10/Product SUNWsmbar //光盘安装SUNWsmbar

Processing package instance <SUNWsmbar> from </cdrom/sol_10_910_x86/Solaris_10/Product>

samba - A Windows SMB/CIFS fileserver for UNIX (Root)(i386) 11.10.0,REV=2005.01.08.01.09

Copyright (C) 2001 Samba Team

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software

Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

This appears to be an attempt to install the same architecture and

version of a package which is already installed. This installation

will attempt to overwrite this package.

## Executing checkinstall script.

Using </> as the package base directory.

## Processing package information.

## Processing system information.

24 package pathnames are already properly installed.

## Verifying package dependencies.

## Verifying disk space requirements.

## Checking for conflicts with packages already installed.

## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user

permission during the process of installing this package.

Do you want to continue with the installation of <SUNWsmbar> [y,n,?] y

Installing samba - A Windows SMB/CIFS fileserver for UNIX (Root) as <SUNWsmbar>

## Executing preinstall script.

## Installing part 1 of 1.

[ verifying class <none> ]

[ verifying class <manifest> ]

## Executing postinstall script.

Installation of <SUNWsmbar> was successful. //显示安装成功

[root@solaris186:/cdrom/sol_10_910_x86]# vi /etc/profile //编辑配置文件/etc/profile

"/etc/profile" 47 lines, 741 characters

#ident "@(#)profile 1.19 01/03/13 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3

export LOGNAME PATH

if [ "$TERM" = "" ]

then

if /bin/i386

then

TERM=sun-color

else

TERM=sun

fi

export TERM

fi

# Login and -su shells get /etc/profile services.

# -rsh is given its environment in its .profile.

case "$0" in

-sh | -ksh | -jsh | -bash)

#ident "@(#)profile 1.19 01/03/13 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3

export LOGNAME PATH

if [ "$TERM" = "" ]

then

if /bin/i386

then

TERM=sun-color

else

TERM=sun

fi

export TERM

fi

# Login and -su shells get /etc/profile services.

# -rsh is given its environment in its .profile.

case "$0" in

-sh | -ksh | -jsh | -bash)

if [ ! -f .hushlogin ]

then

/usr/sbin/quota

# Allow the user to break the Message-Of-The-Day only.

trap "trap '' 2" 2

/bin/cat -s /etc/motd

trap "" 2

/bin/mail -E

case $? in

0)

echo "You have new mail."

;;

2)

echo "You have mail."

;;

esac

fi

esac

umask 022

trap 2 3

export PS1='[\u@\h:$PWD]\$ '

export A

A

B

A

B

:q!

[root@solaris186:/cdrom/sol_10_910_x86]# vi /etc/profile

"/etc/profile" 47 lines, 741 characters

#ident "@(#)profile 1.19 01/03/13 SMI" /* SVr4.0 1.3 */

# The profile that all logins get before using their own .profile.

trap "" 2 3

export LOGNAME PATH

if [ "$TERM" = "" ]

then

if /bin/i386

then

TERM=sun-color

else

TERM=sun

fi

export TERM

fi

# Login and -su shells get /etc/profile services.

# -rsh is given its environment in its .profile.

case "$0" in

-sh | -ksh | -jsh | -bash)

if [ ! -f .hushlogin ]

then

/usr/sbin/quota

# Allow the user to break the Message-Of-The-Day only.

trap "trap '' 2" 2

/bin/cat -s /etc/motd

trap "" 2

/bin/mail -E

case $? in

0)

echo "You have new mail."

;;

2)

echo "You have mail."

;;

esac

fi

esac

umask 022

trap 2 3

export PS1='[\u@\h:$PWD]\$ '

export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin:/usr/sfw/sbin //将export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin:/usr/sfw/sbin 添加到文件内得最后一行

"/etc/profile" 48 lines, 799 characters

[root@solaris186:/cdrom/sol_10_910_x86]# vi /etc/sfw/smb.conf //编辑配置文件

"/etc/sfw/smb.conf" [Read only] 271 lines, 9662 characters

# 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

#

# For a step to step guide on installing, configuring and using samba,

# read the Samba-HOWTO-Collection. This may be obtained from:

# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf

#

# Many working examples of smb.conf files can be found in the

# Samba-Guide which is generated daily and can be downloaded from:

# http://www.samba.org/samba/docs/Samba-Guide.pdf

#

# 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]

"/etc/sfw/smb.conf" [Read only] 271 lines, 9662 characters

[root@solaris186:/cdrom/sol_10_910_x86]# svcs -v | grep samba //查看服务是否启动

maintenance - 16:55:17 - svc:/network/samba:default //显示为维护状态

[root@solaris186:/cdrom/sol_10_910_x86]# svcadm clear samba //清除samba的维护状态

[root@solaris186:/cdrom/sol_10_910_x86]# svcadm enable samba //开启samba

[root@solaris186:/cdrom/sol_10_910_x86]# svcs -v | grep samba //查看服务是否启动

online - 17:41:41 100 svc:/network/samba:default //显示samba为启动状态

[root@solaris186:/cdrom/sol_10_910_x86]# /usr/sfw/sbin/nmbd -D //开启nmbd服务

[root@solaris186:/cdrom/sol_10_910_x86]# ps -ef | grep mbd //确认nmbd已经成功开启

root 871 870 0 17:41:42 ? 0:00 /usr/sfw/sbin/smbd -D

root 878 817 0 17:47:18 pts/1 0:00 grep mbd

root 876 1 0 17:46:46 ? 0:00 /usr/sfw/sbin/nmbd -D

root 870 1 0 17:41:42 ? 0:00 /usr/sfw/sbin/smbd -D

[root@solaris186:/cdrom/sol_10_910_x86]# netstat -na | grep 137 //查看网络端口137的状态

*.137 Idle

192.168.6.186.137 Idle

[root@solaris186:/cdrom/sol_10_910_x86]# netstat -na | grep 138 //查看网络端口138的状态

*.138 Idle

192.168.6.186.138 Idle

[root@solaris186:/cdrom/sol_10_910_x86]# smbpasswd -a tom //系统用户转换为samba

New SMB password: //输入密码,无回显

Retype new SMB password: //确认密码,无回显

Added user tom.

[root@solaris186:/cdrom/sol_10_910_x86]# pdbedit -L //查看samba的用户列表

tom:100:

登陆win7下IE浏览器,输入//192.168.6.186,输入用户名、密码进入到共享tom文件夹下。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: