The Samba suite of applications are not just for server use, they can also enable a Linux workstation the ability to mount a shared Windows resource as part of its own filesystem. The smbclient application requires the use of a valid username and password that has been configured on the Microsoft server/workstation that it will be connecting too, unless the guest account has been enabled on the target system.
To obtain a complete list of all the workstations available on the local network, type the "
findsmb" command at the prompt.
[bash]# findsmb |
*=DMB
+=LMB
IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION
---------------------------------------------------------------------
192.168.1.1 GALAXY *[MYGROUP] [Unix] [Samba 3.0.10-2]
192.168.1.101 WINBOX1 [WINBOX1] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.1.102 WINBOX2 [WINBOX2] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.1.103 WINBOX3 [WINBOX3] [Windows 5.1] [Windows 2000 LAN Manager]
192.168.1.104 WINBOX4 [WINBOX4] [Windows 5.1] [Windows 2000 LAN Manager]
|
The smbclient can be used to obtain a detailed list of shared resources from a specified host on the local network. In this example we are asking for a list of resources from the Samba server called "galaxy". Because the server is not configured with an active guest account, we need to pass a valid username (
-U) in the process, in this case alice.
[bash]# smbclient -U alice -L galaxy
Password:
|
Domain=[GALAXY] OS=[Unix] Server=[Samba 3.0.10-2]
Sharename Type Comment
--------- ---- -------
Shared Disk Global Share - All Users
SmallGroup Disk Small Share - Few Users
Financial Disk RESTRICTED - Financial Cell
FTP-Server Disk READ ONLY - Corp FTP Server
IPC$ IPC IPC Service (Samba Server)
ADMIN$ IPC IPC Service (Samba Server)
bubblejet Printer HP PhotoSmart 7200 Series
laser Printer Brother HL-1430 Laser Printer
alice Disk Home Directory
Domain=[GALAXY] OS=[Unix] Server=[Samba 3.0.10-2]
Server Comment
--------- -------
Workgroup Master
--------- -------
MYGROUP GALAXY
|
The following example is similar to above, however we are obtaining a list from the Microsoft client called "winbox1" which is a Windows XP desktop. A valid username (
-U) is also used in the remote request.
[bash]# smbclient -U alice -L winbox1
Password:
|
Domain=[WINBOX1] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename Type Comment
--------- ---- -------
E$ Disk Default share
IPC$ IPC Remote IPC
D$ Disk Default share
ADMIN$ Disk Remote Admin
C$ Disk Default share
Shared Disk Full Share for ALL !!!
Domain=[WINBOX1] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Server Comment
--------- -------
Workgroup Master
--------- ------- |