[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

automating SMB/CIFS share configs (was: Re: relative path in fstab)



on Sun, Feb 20, 2005 at 02:53:08PM -0500, Daniel D Jones (ddjones@riddlemaster.org) wrote:
> On Sunday 20 February 2005 12:47 pm, Roberto C. Sanchez wrote:
> > Daniel D Jones wrote:
> > > Is it possible to put a path relative to the users home directory in
> > > fstab?
> > >
> > > fstab doesn't seem to expand either ~ or $HOME.
> > >
> > > Man and google have been no help.
> >
> > That would not make sense in the context of an fstab.  $HOME belongs to
> > a particular user.  mount is always run as root:
> >
> > -rwsr-xr-x  1 root root 76K Sep 24 00:34 /bin/mount
> >
> > Thus, $HOME would always expand to /root.  Why not just specify the
> > absolute path?
> 
> I have a number of network paths I want to mount.  I don't want to
> pollute the root directory with a bunch of extra paths.  I could add
> the directories under /mnt or a custom root directory, such as /shares
> or /network but I don't like that for a few reasons.  Some of our
> users are less than clueful.  I'd prefer to avoid them having to type
> or click through a long path.  And for many programs, when you go to
> open or save a file, the default location in the file picker dialog is
> your home directory.  So I wanted to mount them in the users home
> directory by adding them to fstab with the noauto option and mounting
> from the users login script.
> 
> The workaround I've come up with is to mount them under /mnt and to create 
> links to the mountpoints in the users home directory.

My fix would be similar.

autofs allows you to mount filesystems on demand, including smbfs
filesystems.

I usually create a '/net/' top-level directory, with subdirs for each
remote host.  Within a host, you specify shares.  These are symlinks to
/var/autofs/misc/<host>_<share>

/etc/auto.misc has entries for each share.  One key element is the
authentication data -- you can specify a "credentials" file.

You can also create home-directory symlinks to the /net paths as well.
Running this as part of your account creation process may be useful.


Benefit:  it works.  You don't mount a share until it's needed.  With a
short timeout (I use 1-3 seconds), the shares are mounted only when in
use.  This gets around issues on legacy MS Windows networks,
particularly where peer-based networking is used (Workgroup, as opposed
to Domain), and each client only allows a maximum of ten shares -- each
GNU/Linux user + share instance counts as one share.

Downside:  there's a fair bit of maintenance involved in both setting it
up and keeping it going as users and/or servers and/or shares are
added/removed from the system.


Ideally you'd have a cleaner setup than this, and/or something which is
automatically set up and maintained.  I'm not aware of anything which
does this automatically, though a large portion of scanning for shares
and setting up configuration can be scripted.  An LDAP based
authentication system would also be handy (avoid the credentials files).


There are other systems for accessing shares, most of them specific to
desktops, and involving GUI file manager type tools.  I find these to be
hackish, and not particularly suited to how I do things (mostly command
line -- with access expected from multiple programs).   One problem is
that the legacy MS Windows implementation of SMB/CIFS is based on one
user, one system, while GNU/Linux allows n:m relationships (multiple
users on a given box, one box on multiple networks).  Toss in an ad-hoc
network structure and you've got a rapidly evolving maintenance mess.


Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
    Warning:  plot details follow.

Attachment: signature.asc
Description: Digital signature


Reply to: