Browsing the Windows network with your linux machine with automatic mounting and discovery of all hosts and shares.
The most recent version you'll find at:
For some time I've been looking for a good way to let my computer discover the Windows network and mount shares on demand. There isn't a good enough solution for at this moment. After trying the kioslaves in the desktop of my choice (KDE) and the FUSE programs Fusesmb and SmbNetFs, I was not really satisfied. There had to be an way to let my computer discover all the workgroups/domains, the hosts and the shares, and mount a share on a hosts on demand. Some will say: mount the shares of your choice by hand, and off you go. But no!! This is not what I want. I can let my computer discover automatically discover all the hosts and shares available, and mount the share only when needed. This should be possible! And after trying I've found out it is!
The following issues are necessary imho:
The FUSE program Fusesmb comes very near to what I'm looking for, but lacks the extended capabilities CIFS has, like the right presentation of the permissions, support of inotify, symlink and ATTR/ACL. It took me some time to find out why the FUSE program lacks these features. FuseSMB is based upon the smbclient library smbclient.so, which is part of the Samba package, and has nothing to do with smbfs or cifs.
The result of this construction is a networkrelated directory (Global Network) in your homedirectory, where the automounter provides a browseable tree to access all the supported networkservices.
At this moment it supports the services SMB and SSH (I'm working on FTP). Accessing the "network mountpoint":
Accessing the Windows Network (==smb), all the workgroups and/or domains appear:
Entering the workgroup CWWERKGROEP, all the servers and other hosts do show up:
Entering the server ROUTER, the shares available to the connecting user appear:
Accessing a share, it's automatically mounted (with CIFS or SMBFS). The use of credentials is supported, guest logins are the default.
To build the "multi mount map" for the smb service, a networkcache is used. It provides information about workgroups and/or domains. hosts and server and shares available. It is maintained by some scripts, which make use of some utilities (nbtscan to determine the hosts and workgroups/domains and smbclient to determine the shares per host).
Accessing the SSH hosts (=ssh), all the hosts where this user has access to appear:
Here no cache is used to create this tree, but the file .known_hosts. Futher there was no mount.sshfs available. I've created one, using FUSE and sshfs. (and umount.sshfs).
How does it work
This construction makes use of the automounter. When an user logs in, and a new session starts, a "networkmountpoint" to the auto.master file is added and the automounter daemon gets a "reload" signal. This mountpoint, name default "Global Network" is in the homedirectory of the user. Linked to it is a script (auto.network) which creates a map, based on all the networkservices supported and resources discovered. Together with the browse option, this provides a browseable map, where shares/hosts are mounted when accessed.
When the user logs off, and thus the session ends, the mountpoint is removed again, and the automounter daemon gets a reload signal again to make the changes effective.
Here the ability of KDM to run scripts with root privilege at the beginning and the end of a session is used.
At this moment only SMB and SSH are supported.
There are some bottlenecks:
a guide to setup autofs for SMB shares, using existing files;
a guide to setup autofs to access shares in an alternative way.
Here almost the same construction is used to mount hardware using autofs with udev. Here also mountpoints are dynamically added and removed to the auto.master file.