- replacement for smbclient and smbfs

Andrew Tridgell tridge at
Fri Oct 2 05:10:14 GMT 1998

Some work I am doing at ANU prompted me to think about an alternative
solution to the current smbfs, smbclient and smbtar utilities. 

I've now started writing a shared library that implements things like
open(), close(), read() etc as wrappers. You can then use the
LD_PRELOAD capability of many modern OSes to preload the library and
thus override the standard functions for existing binaries.

What this means is that we can start using a large number of existing
programs to access SMB servers. The library detects if the file being
referenced is in the /smb/ directory and if not then it called the
normal system call rather than using SMB. This allows you to interact
with normal files as well as smb files.

So far what I've got working is:

- "cp /smb/fjall/share/path/foo.dat /tmp/" correctly copies files from

- ls works

- cmp works

- cat works

- GNU tar works for reading from SMB shares (ie. backups). I'll do
  writing soon.

The whole thing is still _very_ alpha and there are gaping holes, but
I haven't yet found any reason why we won't be able to wrap virtually
all file operations in this way. That should mean that as far as the
user is concerned they see a full smb filesystem.

Advantages over smbfs:

- no kernel changes
- no root privileges needed
- theoretically portable to a large range of OSes. In practice I don't
  know how portable it will be. I've only tested on Linux with glibc2
  (a RH5.1 box) so far.
- don't need a explicit mount operation

Advantages over smbclient/smbtar:

- can use standard tools rather than rather limited smbclient commands
- full GNU tar capibilities are available (it _is_ GNU tar)
- can use things like "cp -a" and other nice tools.
- it takes _much_ less code. I only had to write about a dozen
  functions for tar to work.

Authentication is currently done via SMBW_USER and SMBW_PASSWORD
environment variables (yeah, I know, security hole). I think a scheme
like the ssh-agent one for authentication will be needed.

I also want to do things like:

- ls in /smb/ will list all workgroups
- ls in /smb/group/ will list machines in that group
- ls in /smb/group/host/ will list shares on that server
- "ls -laR" in /smb/ will clog up your network for hours :-)

I'll commit the first version of this stuff to the CVS tree tonight or
tomorrow. It won't be enabled by default.

Cheers, Tridge

More information about the samba-technical mailing list