Dynamically mount shares - Debian

This is a discussion on Dynamically mount shares - Debian ; Hi! At home, I have a server with some files I'd like to access. The server contains both files in 'shared' directories (which means others can access them too) and in 'private' directories (for my eyes only). I'm looking for ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Dynamically mount shares

  1. Dynamically mount shares

    Hi!

    At home, I have a server with some files I'd like to access. The server
    contains both files in 'shared' directories (which means others can
    access them too) and in 'private' directories (for my eyes only). I'm
    looking for the best way to mount these directories.

    First of all, I cannot use NFS (except maybe for NFSv4), because the
    user/group IDs on my laptop do not match those on my server. Instead, I
    think I'll use cifs.

    The problem is how to setup the mounting in the best way. I cannot just
    mount the shares, as they might not be available all the time (I use the
    laptop elsewhere as well). Likewise, pam_mount doesn't work, because I
    might login at one place, suspend and then resume at home, in which case
    I wouldn't have access to the shares. So I guess I need some automounter
    for this to work.

    Now, I'm having trouble understanding how to set this up. I need to use
    some credentials to mount the shares, which I can store in my home
    directory. The problem is that in that case, it only works for one
    account (mine) on the laptop. Or is there some way to have the
    automounter look at who's trying to access the directory, and use
    his/her credentials?

    I'm up for any other way that might work as well. I tried NFSv4 but I
    couldn't find useful documentation, and it requires me to set up quite
    some things (including Kerberos).

    Thanks for any pointers!

    Koen


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  2. Re: Dynamically mount shares

    On Sun, Dec 10, 2006 at 04:19:16PM +0100, Koen Vermeer wrote:
    > Hi!
    >
    > At home, I have a server with some files I'd like to access. The server
    > contains both files in 'shared' directories (which means others can
    > access them too) and in 'private' directories (for my eyes only). I'm
    > looking for the best way to mount these directories.
    >
    > First of all, I cannot use NFS (except maybe for NFSv4), because the
    > user/group IDs on my laptop do not match those on my server.


    see the section regarding mapping in exports(5) .

    > Instead, I
    > think I'll use cifs.
    >
    > The problem is how to setup the mounting in the best way. I cannot just
    > mount the shares, as they might not be available all the time (I use the
    > laptop elsewhere as well). Likewise, pam_mount doesn't work, because I
    > might login at one place, suspend and then resume at home, in which case
    > I wouldn't have access to the shares. So I guess I need some automounter
    > for this to work.
    >
    > Now, I'm having trouble understanding how to set this up. I need to use
    > some credentials to mount the shares, which I can store in my home
    > directory. The problem is that in that case, it only works for one
    > account (mine) on the laptop. Or is there some way to have the
    > automounter look at who's trying to access the directory, and use
    > his/her credentials?


    autofs should be able to do that. You can define custom mount options,
    if you want.

    -- Tzafrir


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  3. Re: Dynamically mount shares

    Op zo, 10-12-2006 te 10:51 -0500, schreef Tzafrir Cohen:
    > On Sun, Dec 10, 2006 at 04:19:16PM +0100, Koen Vermeer wrote:
    > > First of all, I cannot use NFS (except maybe for NFSv4), because the
    > > user/group IDs on my laptop do not match those on my server.

    > see the section regarding mapping in exports(5) .


    I already did that and I just did it again. It says that the same
    uid/gids may not always be present. It does not, as far as I can tell,
    give a solution. The options are to convert root to a specified uid, or
    to convert all users to a specified uid. I cannot convert uid 1002 to
    uid 1000, and uid 1001 to uid 1004.

    > > Now, I'm having trouble understanding how to set this up. I need to use
    > > some credentials to mount the shares, which I can store in my home
    > > directory. The problem is that in that case, it only works for one
    > > account (mine) on the laptop. Or is there some way to have the
    > > automounter look at who's trying to access the directory, and use
    > > his/her credentials?

    > autofs should be able to do that. You can define custom mount options,
    > if you want.


    Sure, but how do I define these custom mount options, on a per-user
    basis? For user a, it should look in /home/a/.cifscredentials, and for
    user b, it should look in /home/b/.cifscredentials. Do you know of any
    example that does this, or something close?

    Thanks!

    Koen



    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  4. Re: Dynamically mount shares

    Op zo, 10-12-2006 te 17:47 +0100, schreef Koen Vermeer:
    > > autofs should be able to do that. You can define custom mount options,
    > > if you want.

    > Sure, but how do I define these custom mount options, on a per-user
    > basis? For user a, it should look in /home/a/.cifscredentials, and for
    > user b, it should look in /home/b/.cifscredentials. Do you know of any
    > example that does this, or something close?


    It seems like I've got it to work. It needs more testing, but I guess
    the rest is fine-tuning. This is the setup:

    # /etc/auto.master
    /automnt /etc/auto.automnt

    # /etc/auto.automnt
    * -fstype=autofs,-Duser=& file:/etc/auto.automntuser

    # /etc/auto.automntuser
    * -fstype=cifs,otheroptions,credentials=/home/${user}/.cifscredentials
    hostname:/&

    This means that /automnt/johndoe/sharename will mount
    hostname:/sharename with the credentials
    file /home/johndoe/.cifscredentials. I then simply created some links
    from the users home directories to these /automnt-directories, et voila!
    I can add another layer such that the host is also in the path
    (e.g., /automnt/johndoe/hostname/sharename), but in my setup, there's
    only one host anyway.

    Koen


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  5. Re: Dynamically mount shares

    * Koen Vermeer [061210 10:19]:
    > Hi!
    >
    > At home, I have a server with some files I'd like to access. The server
    > contains both files in 'shared' directories (which means others can
    > access them too) and in 'private' directories (for my eyes only). I'm
    > looking for the best way to mount these directories.
    >
    > Koen
    >


    If you are using a new enough kernel, I highly recommend sshfs, which is
    a FUSE filesystem that uses ssh. You can mount a subtree of a remote
    filesystem and then access it with the same permissions as if you were
    using an ssh session (which you are). Also the mount can be done by a
    regular user; root privileges (or predefined entries in fstab) are not
    necessary.

    ....Marvin


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  6. Re: Dynamically mount shares

    On Sun, 2006-12-10 at 19:13 -0500, Marvin Renich wrote:
    > If you are using a new enough kernel, I highly recommend sshfs, which is
    > a FUSE filesystem that uses ssh. You can mount a subtree of a remote
    > filesystem and then access it with the same permissions as if you were
    > using an ssh session (which you are). Also the mount can be done by a
    > regular user; root privileges (or predefined entries in fstab) are not
    > necessary.


    Sure, I could use sshfs instead of cifs. But that still leaves the
    question of how to do the dynamic mounting. I do not want to type in
    some mount command before I can access the share. Rather, it should just
    be there, whenever I need it and can access it. So that leads me to
    autofs again, but then there's not a real difference between sshfs and
    cifs, right? Or is there some easier way to accomplish this with sshfs?

    Koen



    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  7. Re: Dynamically mount shares

    * Koen Vermeer [061211 05:00]:
    > Sure, I could use sshfs instead of cifs. But that still leaves the
    > question of how to do the dynamic mounting. I do not want to type in
    > some mount command before I can access the share. Rather, it should just
    > be there, whenever I need it and can access it. So that leads me to
    > autofs again, but then there's not a real difference between sshfs and
    > cifs, right? Or is there some easier way to accomplish this with sshfs?
    >
    > Koen
    >


    Okay, I was not addressing the auto-mounting part of your question. I
    was assuming the auto-mounting and the type of mount were independent,
    and I was merely recommending sshfs because it is secure and handles
    Linux permissions natively. Perhaps CIFS also handles Linux permissions
    natively, but I was under the impression that CIFS was a next-generation
    replacement for SMB and that it had the same Windows-to-Linux permission
    mapping problems that SMB has (perhaps permission handling is one of the
    ways CIFS is better than SMB). Also, sshfs is inherently secure; I
    don't know about CIFS.

    ....Marvin


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  8. Re: Dynamically mount shares

    On Tue, 2006-12-12 at 07:30 -0500, Marvin Renich wrote:
    > Okay, I was not addressing the auto-mounting part of your question. I
    > was assuming the auto-mounting and the type of mount were independent,
    > and I was merely recommending sshfs because it is secure and handles
    > Linux permissions natively. Perhaps CIFS also handles Linux permissions
    > natively, but I was under the impression that CIFS was a next-generation
    > replacement for SMB and that it had the same Windows-to-Linux permission
    > mapping problems that SMB has (perhaps permission handling is one of the
    > ways CIFS is better than SMB). Also, sshfs is inherently secure; I
    > don't know about CIFS.


    I know that CIFS has something like extended attributes, but I'm not
    (yet) sure what's covered exactly. The man page of mount.cifs says
    something about 'CIFS Unix extensions', in relation to user and group
    ids, file/dir modes, etc. This is, by default, enabled in Samba.

    Anyway, I agree that sshfs is a more natural choice in a Unix
    environment. The only disadvantage may be speed issues, but I haven't
    checked the amount of overhead in sshfs. One major advantage is, of
    course, that I might decide to allow access to the server from the
    Internet, so the files may be accessed from anywhere. I wouldn't
    consider doing that with CIFS.

    Koen



    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

+ Reply to Thread