smbsh and smbwrapper - porting help needed

Andrew Tridgell tridge at
Mon Oct 5 11:59:58 GMT 1998

Someone asked today about smbfs on HPUX. The basic answer to that is
that smbfs is _very_ operating system specific so it would take quite
a lot of work to get it to run on another OS.

There is hope though. Over the past few days I have been developing
something called smbwrapper (and smbsh). This offers most of the
capabilities of smbfs in a way that makes it somewhat portable. It
also provides several features that smbfs doesn't. I'm hoping that
smbsh will be reasonably complete for Samba 2.0.

What does it do? smbwrapper is a set of posix filesystem functions
designed to be preloaded by your OSes loader so that all your existing
binaries _think_ that they have a full SMB filesystem available, even
though they don't. captures all important system calls
and redirects them either to the normal system call (if the call
wasn't to an SMB file) or to the Samba client code.

The result is that you can run your existing binaries after setting an
environment variable to enable the library and the binaries will be
able to access remote SMB filesystems just like they were using a real
SMB filesystem.

For example, while running bash under smbwrapper I can:

    cd /smb
    [ listing of machines in my workgroup ]
    cd machine
    [ listing of shares on that machine ]
    cd share
    [ listing of files on that share ]
    emacs foo.txt
    [ run emacs on that file]

You can also:

- print by copying a file with cp to a printer share (printers appear
  as directories)
- see the print queue by doing a ls in that directory
- delete entries from the print queue using rm

Things that I've tested and appear to work:

  emacs, tar, ls, cmp, cp, rsync, du, cat, rm, mv, less, more, wc, head,
  tail, bash, tcsh, mkdir, rmdir, vim, xedit, diff

Things that don't work:

- executing programs from the smb filesystem 
- mmap of files
- output redirection from shells (eg. "echo hello > foo.txt")

these things can all be fixed, but it will take time.

So far smbwrapper is working on:

Linux 2.0 with glibc2 (RH5.1)
Linux 2.1 with glibc2
Solaris 2.5.1 
Solaris 2.6
IRIX 6.4

It should be portable to a wide range of OSes, but each OS requires
some work to do the port. 

If you want to participate in the development of smbwrapper then grab
the latest code from the CVS tree and join the discussions on the
samba-technical mailing list. Please only do this if you are willing
to put in some effort to help, we don't want the list flooded with
requests from non-technical users (we can get those once this stuff is

What we do want is people willing to help port this to other OSes. If
you have access to an OS not listed above and are a competent systems
programmer (some of the tricks used in smbwrapper are quite subtle)
then please help out!

So far the only system that I've tried to port it to that has defeated
my efforts in AIX. If anyone knows how to make LD_PRELOAD or something
equivalent work on AIX then let me know.

Cheers, Tridge

More information about the samba mailing list