2try: Idea to get proper access to all kind of resources (local and remote) via FUSE and the automounter.

Stef Bon stef at bononline.nl
Tue Jan 5 13:50:16 GMT 2010


I've been working on a construction for a long time now, and te create
easy, functional access to all kind of resources
like SMB shares, FTP servers, SSH and USB devices while making use of
the best tools to mount them. In the case
of SMB shares that is mounting with cifs. Prepare for a long story, it's
not so easy to explain.

This construction is based upon two techniques I've integrated to work
The first one is the automounter, which mounts targets on demand. In my
construction it is designed to work
with what I call resource records. These records contain all the
infromation about a resource and how to mount it.

It looks like:

/var/cache/mount.md5key/b4a0859ac795f50baf7e43ff4f49f314 contains


The name of this record is b4a0859ac795f50baf7e43ff4f49f314, all the
information is in the config file.
Other files do have a meaning, but it's to complicated to tell about
that here.

The config file looks like:


Now the automounter makes use of these records the following way

An apart auto.master (created for this purpose only) is in
/var/run/autofs, looking like:

/mnt/mount.md5key/sbon/mount  /etc/autofs/auto.md5key MD5KEY_USER=sbon
/mnt/mount.md5key/root/mount  /etc/autofs/auto.md5key MD5KEY_USER=root

(users sbon and root are making use this construction)

where the auto.md5key is:

*       -fstype=md5key :/&

Very simple and straightforward, just passing every key to the
mountcommand of the nonexistent filesystem
md5key. This mount.md5key is a wrapper, and intelligent enought to do a
lookup of the key, and launch the right
mount command, in the case of SMB this is mount.cifs.

So when I do:

ls /mnt/mount.md5key/sbon/mount/b4a0859ac795f50baf7e43ff4f49f314

the share //LFS20060812/public is mounted there, using credentials
(which are stored in a file).

Maintenance of these resource records are done trhough scripts (making
use of utilities like nbtscan, nmblookup and smbclient)

Now this constrcution is not to be used directly, but in cooperation
with a fusemodule I've developed.
But first, you can make use of this mounting ability, by creating a tree
with symlinks:

A "Windows Network" tree may look like:

/home/sbon/Network/Windows Network/BONONLINE/ADMIN/admin	  -> 
                                             	  /documentation  -> 
                                                   /public	  -> 
                                                   /sbon	          -> 

Now this works, but is not userfriendly in my opinion. When browsing to
these links and following them,
most applications forget the place where they are coming from, and the
user ends up browsing in /mnt/mount.md5key/... tree, for an average user a
strange place. Should not happen.
(there are more cons to this, every time an user enters this directory
all targets are mounted, cause most applications want to "know" what
symlinks are ointing to. Also most apps in KDE look for a .directory
file, also causing unnec. mounting)

So that;s why I've created the FUSE mocules fuse-workspace and
fuse-workpace-union. The first is a first try, with hardcoded paths.
The second one it way more advanced, with different parameters, and has
integration with the automounter, and can do some caching.

Now these modules are overlay filesystems, which "mirror" another
directory (the "bind" directory) into the mounted dir, just like
the fusexmp (part of the FUSE source) does with the root (/) .

Next to mirror, they are able to make symlinks (to dirs) look like

mkdir -p /home/sbon/.fuse/bind
mkdir -p /home/sbon/.fuse/conf

mv /home/sbon/Network /home/sbon/.fuse/bind

mkdir /home/sbon/Workspace

fuse-workspace-union --bind-directory=/home/sbon/.fuse/bind \
                      --conf-directory=/home/sbon/.fuse/conf \

Now without any action the symlinks above remain unchanged:

cd /home/sbon/Workspace/Network/Windows Network/BONONLINE/ADMIN
ls -l
lrwxrwxrwx 1 root root 61 2009-12-31 21:17 admin         -> 
lrwxrwxrwx 1 root root 61 2009-12-31 21:17 documentation -> 
lrwxrwxrwx 1 root root 61 2009-12-31 21:17 public        -> 
lrwxrwxrwx 1 root root 61 2009-12-31 21:17 sbon          -> 

Now create directories in the conf tree, to instruct
fuse-workspace-union to translate the symlinks to shares to directories

install --directory /home/sbon/.fuse/conf/Network/Windows\ 
install --directory /home/sbon/.fuse/conf/Network/Windows\ 
install --directory /home/sbon/.fuse/conf/Network/Windows\ 
install --directory /home/sbon/.fuse/conf/Network/Windows\ 

Now the same command

cd /home/sbon/Workspace/Network/Windows Network/BONONLINE/ADMIN
ls -l
drwxr-xr-x 2 sbon netgroup 61 2009-12-31 21:17 admin
drwxr-xr-x 2 sbon netgroup 61 2009-12-31 21:17 documentation
drwxr-xr-x 2 sbon netgroup 61 2009-12-31 21:17 public
drwxr-xr-x 2 sbon netgroup 61 2009-12-31 21:17 sbon

Now when listing the contents of this directory does not make all
targets to be mounted.

This does not only work for SMB shares, but also for FTP, SSH and I'm
convinced for IPX( Novell Netware) also.
And for local resources like USB devices. Right now there is mounting by
HAL of these devices, but I'm not so happy with that.
(soon to be replaced by udisk) The problem is that mounting of a device
by more than one user (MultiSeat!!) is not possible.
I've posted serveral meddages about this topic in de hal and udisk
maillist, no reply recieved)

With this construction, no problem. Each user has her/his own (autofs
managed) mountpoint in /mnt/mount.md5key/...
with her/his own options, and this is mirrored into her/his homedirectory.
I' do not have investigated this futher, but by mirroring the
mountpoints to somewhere in your homedirectory, maybe it's also
possible to do some translation from  charset to charset...

Now, it's easy to add the automounted directory and the
fuse-workspace-union mounted when a session starts through ConsoleKIt
(and the at daemon)
which has the ability to run scripts when a session is added (and when a
session is removed)
Futher is also not so hard to automate the proces of maintaining the
"resource records". Through a script which looks for SMB server with
nbtscan and
determines the shares with smbclient for every user looged in, and run
that every 5 minutes.
And it's possible to automate the propagation of changes into the
connections trees in the homedirectories of users.

Now I write this email to get this construction work better with KDE.
Gnome has something also with FUSE (the Gnome Virtual Filesystem/ gio).
And in my opinion KDE needs something better than kio slaves!
This construction makes use of real paths, making resources available
just for every application, just like entering a directory.
It's making use of the cifs filesystem to access SMB shares, which has
more features than the kio slave for smb, like support of
ACL/.ATTR, oplocking, transparant uid/gid/permission in environments
with a shared id database like LDAP or ADS (with winbind).

And mentioned above more servives like FTP, IPX and local mounting is

More about this:




Hhere you'll find also screenshots.
Note the icons, I'v put a lot of
effort in making fuse-workspace-union handle these right.
I hope I recieve at least a reaction what you think. Any reaction is
welcome. I've put a lot of effort in developing this constrcution,
learned C, and posted about this before, but very few reactions, while
I'm convinced that this construction has potential.
On my system it's working, and I'm very happy with it. It's so
convenient and functional. I know that the documentation is not up
to order, but I'm working on it.

Maybe this should go to brainstorm, maybe.

Stef Bon

This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

More information about the kde mailing list