smbclient的使用

1,查看smb服务器
[root@localhost ~]# findsmb
 
                                *=DMB
                                +=LMB
IP ADDR         NETBIOS NAME     WORKGROUP/OS/VERSION
---------------------------------------------------------------------
192.168.2.3     CR018          [CREATECH] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.0.19    unknown nis name
192.168.2.20    CHANGLANJUN    [CHANGLANJUN] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.2.25    CR002          [CREATECH] [Windows 5.1] [Windows 2000 LAN Manager]

2,查看单台smb服务器的共享了哪些文件夹
[root@localhost ~]# smbclient -L //192.168.2.98 -U
Password:
Domain=[WWW-A7F9CEEA9FA] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
 
        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC        IPC
        test            Disk     
        centosrpm       Disk     
session request to 192.168.2.98 failed (Called name not present)
session request to 192 failed (Called name not present)
Domain=[WWW-A7F9CEEA9FA] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
 
        Server               Comment
        ---------            -------
 
        Workgroup            Master
        ---------            -------

3.进入文件夹
[root@localhost ~]# smbclient   //192.168.2.98/test -U administrator%test/(2009/)
(注意:这里用到后斜杠转义,即()是不被smbclient接受,所以在()的前面加上斜杠,转换普通能接收的字符).
Domain=[WWW-A7F9CEEA9FA] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \> ls
  .                                   D        0  Wed May 20 14:43:54 2009
  ..                                  D        0  Wed May 20 14:43:54 2009
  c1.txt                              A       74  Wed May 20 13:57:49 2009
  china.txt                           A        0  Wed May 20 14:43:43 2009
  news.txt                            A      218  Wed May 20 08:56:40 2009
 
                50218 blocks of size 1048576. 37119 blocks available
smb: \>

4.挂载 mount -t cifs //ip/文件夹 /mnt/文件夹 -o user=用户
注:cifs是samba的文件系统格式
[root@localhost ~]# mount -t cifs //192.168.2.98/test /mnt/samba/ -o user=administrator
Password:
[root@localhost ~]# ls /mnt/samba/
c1.txt  china.txt  news.txt

5.umout 卸载
[root@localhost ~]# umount /mnt/samba/

你可能感兴趣的:(linux,职场,休闲,smbclient)