Chinaunix首页 | 论坛 | 博客
  • 博客访问: 88734
  • 博文数量: 21
  • 博客积分: 1416
  • 博客等级: 上尉
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2005-09-02 14:45
文章分类

全部博文(21)

文章存档

2010年(2)

2009年(7)

2007年(3)

2006年(2)

2005年(7)

我的朋友

分类: BSD

2007-08-24 19:33:07

OpenBSD下使用samba环境:OpenBSD i386 4.0
1、安装samba(如果需要使用swat安装ldap才能使用)
--------------------------------------------------------------
OpenBSD%uname -a
OpenBSD OpenBSD.org 4.0 GENERIC#1107 i386
--------------------------------------------------------------
系统软件包:我这里安装的是samba-3.0.21bp3-ldap,需要安装的依赖包cyrus-sasl-2.1.21p2、libutf8-0.8、openldap-client-2.3.24、popt-1.7p0
--------------------------------------------------------------
OpenBSD%pkg_info
colorls-3.9         ls that can use color to display file attributes
cyrus-sasl-2.1.21p2 RFC 2222 SASL (Simple Authentication and Security Layer)
expat-2.0.0         XML 1.0 parser written in C
gettext-0.14.5p1    GNU gettext
libiconv-1.9.2p3    character set conversion library
libutf8-0.8         provides UTF-8 locale support
openldap-client-2.3.24 Open source LDAP software (client)
popt-1.7p0          getopt(3)-like library with a number of enhancements
samba-3.0.21bp3-ldap SMB and CIFS client and server for UNIX
vim-7.0.42-no_x11   vi clone, many additional features
--------------------------------------------------------------
本地机IP
--------------------------------------------------------------
OpenBSD#ifconfig pcn1
pcn1: flags=8843 mtu 1500
        lladdr 00:0c:29:de:21:78
        media: Ethernet autoselect (autoselect)
        inet 192.168.1.135 netmask 0xffffff00 broadcast 192.168.1.255
        inet6 fe80::20c:29ff:fede:2178%pcn1 prefixlen 64 scopeid 0x2
--------------------------------------------------------------
服务信息(系统默认就有)/etc/services
--------------------------------------------------------------
OpenBSD%cat /etc/services |grep netbios
netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp
netbios-dgm     138/tcp                         # NETBIOS Datagram Service
netbios-dgm     138/udp
netbios-ssn     139/tcp                         # NETBIOS session service
netbios-ssn     139/udp
--------------------------------------------------------------
2、使用swat
1)、在/etc/services中添加一行swat  901/tcp
--------------------------------------------------------------
OpenBSD%cat /etc/services |grep swat
swat            901/tcp                         # swat
--------------------------------------------------------------
2)、在 /etc/inetd.conf中添加一行swat stream  tcp nowait  root    /usr/local/libexec/swat
--------------------------------------------------------------
OpenBSD%cat /etc/inetd.conf |grep swat
swat stream  tcp nowait  root    /usr/local/libexec/swat
--------------------------------------------------------------
3、系统启动时启动samba,在/etc/rc.local中添加
if [ -x /usr/local/libexec/smbd ]; then
        /usr/local/libexec/smbd
fi
if [ -x /usr/local/libexec/nmbd ]; then
        /usr/local/libexec/nmbd
fi
--------------------------------------------------------------
OpenBSD%cat /etc/service.rc
if [ -x /usr/local/libexec/smbd ]; then
        /usr/local/libexec/smbd
fi
if [ -x /usr/local/libexec/nmbd ]; then
        /usr/local/libexec/nmbd
fi
--------------------------------------------------------------
4、查看samba和swat是否启动
--------------------------------------------------------------
OpenBSD%netstat -an |grep 901
tcp        0      0  *.901                  *.*                    LISTEN
OpenBSD%ps -ajx |grep *mbd
ls       26722 15095 19040 d2c2e300    2 R+    p0    0:00.13 grep *mbd
OpenBSD%ps -ajx |grep smbd
root     20993     1 20993 d2c2e150    0 Is    ??    0:00.15 /usr/local/libexec/smbd
root     18776 20993 20993 d2c2e150    0 I     ??    0:00.04 /usr/local/libexec/smbd
ls       14859 15095   974 d2c2e300    2 I+    p0    0:00.08 grep smbd
OpenBSD%ps -ajx |grep nmbd
root     28525     1 28525 d2c2e180    0 Is    ??    0:01.14 /usr/local/libexec/nmbd
--------------------------------------------------------------
5、查看本机共享和连接其他机器共享目录
1)、查看本机共享
--------------------------------------------------------------
OpenBSD%smbclient -L localhost -U ls
Password:
Domain=[OPENBSD] OS=[Unix] Server=[Samba 3.0.21b]
        Sharename       Type      Comment
        ---------       ----      -------
        tmp             Disk      Temporary file space
        IPC$            IPC       IPC Service (Samba Server)
        ADMIN$          IPC       IPC Service (Samba Server)
        ls              Disk      Home Directories
Domain=[OPENBSD] OS=[Unix] Server=[Samba 3.0.21b]
        Server               Comment
        ---------            -------
        Workgroup            Master
        ---------            -------
        MYGROUP              OPENBSD
--------------------------------------------------------------
2)、连接其他机器共享目录(目标机器为WindowXP--192.168.1.101,共享名OpenBSD)
--------------------------------------------------------------
OpenBSD%smbclient -U administrator //192.168.1.101/OpenBSD
session request to 192.168.1.101 failed (Called name not present)
session request to 192 failed (Called name not present)
Password:
Domain=[NDIS] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \> ls
  .                                   D        0  Fri Aug 24 18:43:03 2007
  ..                                  D        0  Fri Aug 24 18:43:03 2007
  colorls-3.9.tgz                     A   148448  Sun Sep 24 12:00:00 2006
  cyrus-sasl-2.1.21p2.tgz             A   667200  Sun Sep 24 12:00:00 2006
  libutf8-0.8.tgz                     A   106471  Sun Sep 24 12:00:00 2006
  openldap-client-2.3.24.tgz          A  1242023  Sun Sep 24 12:00:00 2006
  samba-3.0.21bp3-ldap.tgz            A 11170708  Sun Sep 24 12:00:00 2006
                40413 blocks of size 131072. 25628 blocks available
smb: \>
OpenBSD%smbclient -U administrator //192.168.1.101/OpenBSD
session request to 192.168.1.101 failed (Called name not present)
session request to 192 failed (Called name not present)
Password:
Domain=[NDIS] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \> ls
  .                                   D        0  Fri Aug 24 18:43:03 2007
  ..                                  D        0  Fri Aug 24 18:43:03 2007
  colorls-3.9.tgz                     A   148448  Sun Sep 24 12:00:00 2006
  cyrus-sasl-2.1.21p2.tgz             A   667200  Sun Sep 24 12:00:00 2006
  libutf8-0.8.tgz                     A   106471  Sun Sep 24 12:00:00 2006
  openldap-client-2.3.24.tgz          A  1242023  Sun Sep 24 12:00:00 2006
  samba-3.0.21bp3-ldap.tgz            A 11170708  Sun Sep 24 12:00:00 2006
                40413 blocks of size 131072. 25628 blocks available
smb: \> quit
--------------------------------------------------------------
6、添加一个共享(这里修改一下已存在的/tmp共享,可写)
--------------------------------------------------------------
OpenBSD%su
Password:
OpenBSD#vim /etc/samba/smb.conf
# This one is useful for people to share files
[tmp]
   comment = Temporary file space
   path = /tmp
#   read only = no
   public = yes
   writeable = yes
OpenBSD#ps -ajx |grep mbd
root     20993     1 20993 d2c2e150    0 Is    ??    0:00.15 /usr/local/libexec/smbd
root     18776 20993 20993 d2c2e150    0 I     ??    0:00.04 /usr/local/libexec/smbd
root     28525     1 28525 d2c2e180    0 Is    ??    0:01.26 /usr/local/libexec/nmbd
root     11507 27966 32136 d2c2e300    2 R+    p0    0:00.02 grep mbd
OpenBSD#kill -KILL 18776
OpenBSD#kill -KILL 20993
OpenBSD#kill -KILL 28525
OpenBSD#ps -ajx |grep mbd
root     24413 27966 25929 d2c2e300    2 R+    p0    0:00.05 grep mbd
OpenBSD#ksh /etc/service.rc
OpenBSD#ps -ajx |grep mbd
root     27419     1 27419 d2c2e180    0 Is    ??    0:00.38 /usr/local/libexec/smbd
root      9584     1  9584 d2c2e150    0 Is    ??    0:00.21 /usr/local/libexec/nmbd
root     25346 27419 27419 d2c2e180    0 I     ??    0:00.06 /usr/local/libexec/smbd
--------------------------------------------------------------
写入后查看
OpenBSD#cd /tmp/
OpenBSD#ls -l
total 260
-rwxr--r--  1 ls  wheel  132840 Aug 24 17:18 VIM_ quickref.html
==============================================================
补充:(2007-08-25)
其他机器连接时需要用户名和密码,这个用户必须是在系统里存在的,用下边命令添加
--------------------------------------------------------------
OpenBSD#smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
--------------------------------------------------------------
阅读(1277) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~