What can smbclient do for me?

smbclient will let you access any shared resources on a WfW, Win95, NT, OS/2, or unix box running samba. That is any shared discs or printers can be accessed from your RiscPC. You can find out what shares are available on a machine. It also allows you to send (but not receive) popup messages to PCs.

How do I use it?

This is a short intro on how to use this port of smbclient more information can be found in the man page included with this distribution.

smbclient is very similar to ftp, you connect to a machine and then browse the remote file system and download or upload files. Unlike ftp you must know what service you want before you connect to the machine.

You can find out what shares are available by using the '-L hostname' option to list the shares. When connecting to my unix box the smbclient shows the following:

I have an internal network not connected to the internet called with machines named after Liverpool clubs.

  *smbclient -L
  myhostname is (
  login name is WILDLIFE
  Server time is Thu Jul  3 19:54:42 1997
  Timezone is UTC+1.0
  Domain=[CLUBBERS] OS=[Unix] Server=[Samba 1.9.15p8]
  login appeared to be ok
  Server=[voodoo] User=[simon] Workgroup=[CLUBBERS] Domain=[CLUBBERS]
  server info completed
  	Sharename      Type      Comment
  	---------      ----      -------
  	IPC$           IPC       IPC Service (Samba 1.9.15p8)
  	lp             Printer   local line printer
  	ps_hi          Printer   Ghostscript (epson9high)
  	ps_lo          Printer   Ghostscript (epson)
  	public         Disk      Public file space
  	simon          Disk      Home Directories
  	www            Disk      WWW work space
  This machine has a browse list:
  	Server               Comment
  	---------            -------
  	VOODOO               Samba 1.9.15p8
  	UNIT                 Ben Rayner
  	CREAM                Aaaargh.....

Now I've found a service how do I connect?

A quirk of unixlib I guess is that you need to escape all the \'s. connecting to a service looks like this:
smbclient \\\\VOODOO\\public

instead of the normal:
smbclient \\VOODOO\public

which you would find in the man page included in this archive.

when prompted for a password for a public directory just press enter.

when you connect you will be prompted with the root of this share. you can now move about it using 'cd', view directory listings with 'ls' or 'dir' and move files about just like ftp.

I've had transfer rates of almost 400k/sec for large file transfers in a taskwindow on my StrongARM RiscPC from my PC with it's old ISA network card.

What does smbclient need to work?

Make sure it has enough memory to work in >500k is best.

You can help it a lot by giving it some hints as to who you want to login as. the following environment variables can be set:

Set USER simon
Set LOGNAME simon
These do not need to be the same, in the above example I didn't set LOGNAME which defaulted to the hostname of the machine I was connecting from.

The system variable Inet$HostName must be setup, it should be if your connecting over a network.

Set PAGER more
can be used to display a file, note that more is the default program it will try to run.

Porting a newer version?

Not from me. I can supply details and source for this port. UnixLib has improved since this port and so a newer version should port more easily. Other than C language issues with this version of the code there were only problems with the select code and password entry. The rest was working out the correct list of #define features to enable/disable and quirks of #include directory structures.

How about a GUI?

Again not by me. smbclient was written as a command line program and that assumption is held throughout all the code. command line features cannot be removed from the code without re-writing a very large part of this program. The situation has improved over the last couple of years so other libraries may make it easier to write an SMBFS or GUI version of the cient.


Passwords are now hidden when you type them. I tried the unix way but unixlib insisted that you had to press enter at least twice to get the prompt back! so I didn't release that version.

early versions would crash at the end of small transfers that took less than a centisecond to complete. This problem was present in the original sources and was caused by a divide by zero.

What if it goes wrong? Who can I contact?

Tell me about bugs and faults within smbclient. I might do something about them. I ported this program because I was bored one night and got so far that I spent the next 2 evenings finishing off the port. contact me if you want the source code.

bug reports and text dumps of sessions should be sent to me via email as should requests for my current address.

mail to simon@bigblue.........

This port of smbclient has only been lightly tested. login and password checking looks ok as does get and put for disks and put for printers. sending popup messages also works. This program was tested on a unix server running samba and several Win95 machines. Simon Truss
December 1999
latest version of this document smbclient.html