Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: HowTo get files from Window PCs with DSL LiveCD, Using Linux's smbclient & smbtree tools!< Next Oldest | Next Newest >
doublezz Offline





Group: Members
Posts: 5
Joined: Dec. 2005
Posted: Dec. 18 2005,21:37 QUOTE

My problem was how to access my files on a two other Windows machines over a local ethernet network using only the DSL LiveCD tools.  Fortunately, even though the LiveCD does not come with Samba preinstalled for the more user friendly LinNeighborhood graphical client, it does come with built in tools that allow me to do this without too much effort.

The two built-in tools to accomplish this feat are smbclient and smbtree. The latter allows us to browse the network to see what computers are publicly visible, and the former allows us to connect to those computers and to get or put files to or from those computers as is explained in the Dillo's Damnsmall startup page.  The problem I had with the startup Dillo page's explanation was that I was as lost as a newbie with the rather sparse explanation.  I hope to add a few hints to would-be users in this post.

First things first!  You must be connected to a local network, and you must have your DSL machine configured to access that network.  For me, the menu accessible netcard configure tool in DSL LiveCD worked perfectly.  While it can assign you a network ip address you can select your own if you know enough to set yourself up.  If not accept the defaults and then in a Xterm command shell type:
Code Sample
ifconfig
to view your settings.  You should see a setting named eth0 for your ethernet card with an ip address such as 192.168.0.2 netmask 255.255.255.0 ... etc. If you do not see eht0 settings you probably have not got your network interface card configured properly and you probably cannot access the local network.  I can't help you there in this post.

The smbtree tool
Assuming you can access the local network, run in Xterm the following command:
Code Sample
smbtree
which will list in a tree view the workgroups and names of all the computers on the network with publically shared resources (e.g. shared folders or printers).  Note that there may be some computers which have blocked other computers from seeing them unless the other computer logs on with a valid username and password (this might be the case with a Windows2000 server for instance) or they might simply have a firewall in place blocking almost everything that tries to communicate with them.  While you probably still have access to these 'hidden' computers, you will have to know their network names and valid user accounts and passwords they accept, and possibly what access mode they allow (e.g. ssh, ftp, etc.)  I will show you how to log on with the smbclient to a Windows2000 Server for example.

The smbclient tool
First a little background on smbclient.  Many years ago when local networks were being invented, one of the earlier network protocols (i.e. rules for communication) called Netbeui was adopted by a small fledgling but growing company called Microsoft and became for better or for worse standard on all Windows networks ever since. We could say Microsoft's implementation of Netbeui talks in smb (Server Message Block file share) language which was deciphered by some entreprising australian linux hackers (in the positive sense of the word) over a decade ago.  These hackers develeped a number of tools including smbclient and smbtree to allow Linux machines to mascarade as a Windows machine on a Windows network and to communicate with Windows PCs.  The tools developed eventually became part of the SAMBA toolkit which allows complete connectivity between Linux machines and Windows machines ... hoorah!  While the DSL LiveCD does not include the whole SAMBA toolkit to allow us to directly share our Linux box's files over the Windows network, it does have enough tools to upload and download files to and from a Windows PC.  That's where the smbclient tool comes in.  Now we finally can get on to the bit about how to use smbclient.

Smbclient is a command line tool ... so you have to get your hands dirty with using a few commands on Xterm for example.  Smbclient as Mark Minasi reveals "lets you send messages to Win2K, NT, and Windows workstations; display browse lists; and connect to Server Message Block (SMB) file shares".  

Viewing Network Shares: the smbclient uses the -L option (that's capital L) to list what shared resources (i.e. folders or printers) are on a given Windows PC.  Here again you must know the smb name of the machine you want to reach (cf. smbtree above).  The Xterm command line looks like this:
Code Sample
smbclient -L //namdofPC -U Username
Notice the '//' two slashes before the name of the PC that is omitted in the smbclient message command (cf. below) as well as the -U option (NB. a capital U) to pass a username with the request.  Some Windows machines share resources only to designated users with designed passwords.  If the machine you are trying to reach requires a password, type it in when prompted to do so, otherwise hit enter to view the shared resources on the PC you requested the list of shared resources from.  nameofPC?? you ask, where do I find that information?  Well that is where the smbtree (cf. above) tool comes in. It should list visible computers on the network.  If the Windows PC is 'hidden' on the network, you will have to open the Network Neightborhood window on that PC to see its network name.  Once you know the name and path of the shared resource (e.g. a file folder) you want to connect to we can continue to the connection method next.

Connecting to Shared Windows File folders: finally we get to the IMPORTANT PART that allows us to get or send the files we want to or from a Windows PC.  The Xterm command looks like this:
Code Sample
smbclient //nameofPC/sharename -U Username%Password
or simply
Code Sample
smbclient //nameofPC/sharename -U Username
NB that the %Password part of the command is optional and if not required, just press enter to send a blank password to continue.  If you do need a password to access the share you want, the smbclient will prompt you for it if you have not supplied it already. Suddenly your Xterm prompt will change to a smb> prompt.  Here is where you can list, get or send files to and from the Windows machine.  How you ask.  Well if you are familiar with ftp commands this is a breeze but if not, type
Code Sample
help
to view the available commands.  The common commands to use are: dir (to list the directory contents of the shared folder), cd to change to subfolders or parent shared folders, get filename to download a file from the windows machine to your DSL machine, put filename to upload a file from your present working directory on you Linux box (in Xterm type 'pwd' to see which directory you are currently in), !ls (NB. note the shebang exclamation mark symbol before typing the ls command) to view the file contents of your pwd (present working) directory on the DSL machine, mget filenamewith*wildcards to download multiple files, and mput filenamewith*wildcards to upload multiple files from your present working directory on DSL. (NB. you will be prompted to confirm each down/upload file unless you typed in previously before typing in the 'mget/mput' command another smbclient command prompt to turn of the prompting).  Other commands include: delete, rmdir, mkdir, and other familiar MSDOS command line options (type help to see the entire list of available commands and then type help commandname for help on how to use a given command. Now you should be able to upload and download from a Windows PC to your hearts content!

As a final help, sometimes the smbclient will have problems finding the WINS server location (the Netbeui information server) that exists by default on all Windows networks. If this is the case, the above connection command will probably fail.  You may need to add two more options to connect: the -I IPaddress option and the -W NameofWorkgroup option, like this:
Code Sample
smbclient //MyWinPC/MySharedFolder -I 192.168.2.51 -W Winnet -U Doublezz%secret
To find a particular ip address either run the command ipconfig at the Windows PC's command prompt, or try using the ping tool in DSL at the command prompt to test if a given ip is listening: ping 192.168.2.51  The smbtree tool (cf. above) will list the Workgroup names that are visible on the network.  NB: 'Hidden' workgroup names, valid usernames and passwords to user accounts may have to be obtained from your network system administrator.  Also you may have to share a given file folder on a windows machine in order for network users to have access to it.  This is generally done by right clicking on the windows folder (from the Windows machine itself - duh!) and selecting the 'Share Folder' option (with read only, full access or password protected access options usually available).  Windows firewalls may also have to be unblocked by Windows PC users for access to shares for selected users, however this is all beyond the realm of this post on smbclient and smbtree tools in DSL linux.

Sending messages : use the smbclient '-M' option (that's a capital M) to send a message to a Windows PC (NB: this assumes that they are running a client to view and send network messages - e.g. on a windows machine click start > run > type "winpopup.exe" (without the quote marks).  The Xterm command is:
Code Sample
smbclient -M nameofPC
after which you it asks you to type a message to send and when you finish click Ctrl+D to send the message. (NB: there is not '//' before the nameofPC in this command!) If all works wells ... voila - the destination computer will see your message.  I do not think this is a very useful feature though as most Windows Machines do not have a network message client application running most of the time, but between colluding users it does allow a DSL LivecD user to send a network message to a Windows machine.  If you would like to know more about other features available in both smbclient and smbtree tools, in Xterm run either smbclient --help or smbtree --help  There you go ... happy SMBing ... ! :-)

Doublezz

(corrections and additions are welcome).
PS. To give credit where credit is due: I thank Mark Minasi for his very insightful article on Linux's Smbclient Command at
http://www.windowsitpro.com/Articles/Print.cfm?ArticleID=8897 whose examples I adapted for this post.
Back to top
Profile PM 
larkl Offline





Group: Members
Posts: 177
Joined: Sep. 2005
Posted: Dec. 19 2005,14:25 QUOTE

Very nice post with lots of insight and information, thanks.
Back to top
Profile PM 
300c_pilot Offline





Group: Members
Posts: 217
Joined: Dec. 2005
Posted: Jan. 01 2006,07:52 QUOTE

I have used the following command also:
mount -t smbfs //server01/share /mnt

This mounts the file share to the mnt directory, you will have to use root access to get the files though.:)


--------------
300c_Pilot
Boise, Idaho
Back to top
Profile PM WEB 
doublezz Offline





Group: Members
Posts: 5
Joined: Dec. 2005
Posted: Jan. 05 2006,10:24 QUOTE

A question for 300c_pilot:  I have been unable to use the -t smbfs option from a liveCD.  Were you using a hard disk installed version of DSL?

Doublezz
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Jan. 05 2006,19:03 QUOTE

You need to download the "samba.dsl" extension from the MyDSL repository before you will be able to use the -t smbfs file system.
Back to top
Profile PM 
4 replies since Dec. 18 2005,21:37 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: HowTo get files from Window PCs with DSL LiveCD

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code