samba安装和基本命令

简介: samba的安装非常的简单,首先到http://www.samba.org下载最新的tar.gz包,我们在RHEL 4中输入命令wget http://us3.

samba的安装非常的简单,首先到http://www.samba.org下载最新的tar.gz包,

我们在RHEL 4中输入命令wget http://us3.samba.org/samba/ftp/samba-latest.tar.gz

下载完成后tar xvzf samba*.tar.gz

然后执行cd source/;./configure && make && make install && make installbin && make installman

安装完成以后我们就可以看windows的共享目录了,我们首先查看目标我们输入

[root@localhost /]# smbtree
Password:
WORKGROUP
        //CNBIRD

这里就可以看到了共享的机器CNBIRD了,

找到了共享了目录以后我们输入

[root@localhost /]# nmblookup CNBIRD
querying CNBIRD on 192.168.0.255
192.168.0.1 CNBIRD<00>
192.168.1.1 CNBIRD<00>
192.168.234.1 CNBIRD<00>
[root@localhost /]#
我们就可以得到CNBIRD这台机器的IP地址了,这里IP很多,主要是安装了Vmware的原因。

我们下面就来具体的查看我们目录中有什么东西了,

[root@localhost /]# smbclient -L 192.168.0.1 -Uredhat%redhat
Domain=[CNBIRD] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       ÈÂ│╠ IPC
        hacker          Disk
        cnbird          Disk
session request to 192.168.0.1 failed (Called name not present)
session request to 192 failed (Called name not present)
Domain=[CNBIRD] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------
[root@localhost /]#
我们用redhat和密码redhat来进行查看共享。

下面就是我们需要看共享里面的内容了,我们输入

[root@localhost /]# smbclient //192.168.0.1/hacker -U redhat%redhat
Domain=[CNBIRD] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: />
这个时候我们就入了smb里面了,我们输入help来查看一下具体的命令,

smb: /> help
?              altname        archive        blocksize      cancel
case_sensitive cd             chmod          chown          del
dir            du             exit           get            hardlink
help           history        lcd            link           lowercase
ls             mask           md             mget           mkdir
more           mput           newer          open           print
printmode      prompt         put            pwd            q
queue          quit           rd             recurse        reget
rename         reput          rm             rmdir          setmode
stat           symlink        tar            tarmode        translate
vuid           logon          !
smb: />
命令不少,但是看上去和ftp有很多的相同的地方,我们输入ls就可以查看共享文件了,同时也可以使用cd来切换目录,同时可以用get命令下载文件put上传文件等等的操作了,具体的就不操作了。

 

下面就是共享目录的备份了,我们输入命令

[root@localhost /]# smbtar
Usage: smbtar [<options>] [<include/exclude files>]
Function: backup/restore a Windows PC directories to a local tape file
Options:         (Description)                 (Default)
  -r             Restore from tape file to PC  Save from PC to tapefile
  -i             Incremental mode              Full backup mode
  -a             Reset archive bit mode        Don't reset archive bit
  -v             Verbose mode: echo command    Don't echo anything
  -s <server>    Specify PC Server
  -p <password>  Specify PC Password
  -x <share>     Specify PC Share              backup
  -X             Exclude mode                  Include
  -N <newer>     File for date comparison
  -b <blocksize> Specify tape's blocksize
  -d <dir>       Specify a directory in share  /
  -l <log>       Specify a Samba Log Level     2
  -u <user>      Specify User Name             root
  -t <tape>      Specify Tape device           tar.out

Please enter a command line parameter!
[root@localhost /]#
具体的使用是smbtar -s 192.168.0.1 -u redhat -p redhat -x cnbird -t cnbird.tar

本来以为结束了,但是一看没有成功,后来查看资料发现是smbtar这个工具有问题的,我们来看一下解决方法

[root@localhost /]#
[root@localhost /]# locate smbtar
warning: locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old
/usr/share/man/man1/smbtar.1.gz
/usr/share/doc/samba-3.0.10/htmldocs/smbtar.1.html
/usr/bin/smbtar
[root@localhost /]# file /usr/bin/smbtar
/usr/bin/smbtar: Bourne shell script text executable
[root@localhost /]#
smbtar是一个脚本文件,我们最后一行的内容

eval $SMBCLIENT "'////$server//$service'" "'$password'" -U "'$username'" /
-E $log -D "'$cdcmd'" ${clientargs} /
-T${tarcmd}${tarargs} $blocksize $newer $tapefile '${1+"$@"}' $verbose

哈哈我下载的最新的版本已经修改过这个Bug了,以前的是把-N的命令去掉。

 

目录
相关文章
|
4月前
|
网络协议 Unix Linux
哇~真的是你呀!今天是LIUNX中的SAMBA
SAMBA是一个开源的软件套件,用于在Linux和UNIX系统上实现SMB/CIFS网络协议。SMB(Server Message Block)是一种用于在计算机网络上共享文件、打印机和其他资源的协议。CIFS(Common Internet File System)是SMB协议的扩展版本,它提供了更高级的功能和安全性。
44 0
|
7月前
|
Ubuntu 安全 Linux
Linux Ubuntu系统安装OpenVPN服务
Linux Ubuntu系统安装OpenVPN服务
|
7月前
|
Ubuntu Linux
Linux Ubuntu系统 OpenVPN 客户端安装
Linux Ubuntu系统 OpenVPN 客户端安装
Linux Ubuntu系统 OpenVPN 客户端安装
|
19天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
3月前
|
Ubuntu 开发工具 Windows
vim 在windows系统和ubuntu系统中的配置
vim 在windows系统和ubuntu系统中的配置
|
3月前
|
Linux Windows
Linux系统安装Samba服务器
在实际开发中,我们经常会有跨系统之间文件传递的需求,Samba便是能够在Windows和Linux之间传递文件的服务,功能也是非常强大和好用,本篇文章将介绍如何在Linux系统上安装Samba服务,以CentOS7系统为例。
64 0
|
运维 Ubuntu Linux
在Ubuntu中安装Samba文件服务
Samba是一个能让Linux系统应用Microsoft网络通讯协议的软件,而SMB是Server Message Block的缩写,即为服务器消息块 ,SMB主要是作为Microsoft的网络通讯协议,后来Samba将SMB通信协议应用到了Linux系统上,就形成了现在的Samba软件。后来微软又把 SMB 改名为 CIFS(Common Internet File System),即公共 Internet 文件系统,并且加入了许多新的功能,这样一来,使得Samba具有了更强大的功能。
164 0
|
安全 Java Linux
【Linux】远程登陆、远程开发以及Vim的使用
远程登陆、远程开发以及Vim的使用
178 0
【Linux】远程登陆、远程开发以及Vim的使用
|
网络协议 Linux 网络安全
Linux下vsftp安装
Linux下vsftp安装步骤
|
安全 测试技术 Linux
linux上安装配置samba服务器
linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务。如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这篇详解,希望能帮您解决困扰。
2394 0