Loading ...
Sorry, an error occurred while loading the content.

Using a "virtual" mount

Expand Messages
  • Brian Dunphy
    I am not sure of the correct term but I am trying to create a separate mount so that I can keep my FTP users chrooted but give them read only access to other
    Message 1 of 4 , Apr 14, 2005
    • 0 Attachment
      I am not sure of the correct term but I am trying to create a separate
      mount so that I can keep my FTP users chrooted but give them read only
      access to other directories. I went to the BusyBox site (
      http://www.busybox.net/downloads/BusyBox.html )
      and looked the proper way to use mount but I am still having
      trouble.

      Here is the code I used:

      # mount /share/hdd/data/Music /share/hdd/data/Users/Zach/AlbertaMusic
      -o ro
      mount: Mounting /share/hdd/data/Music on
      /share/hdd/data/Users/Zach/AlbertaMusic
      failed: Block device required
      #
    • Josh Parsons
      ... Hi, Brian, mount doesn t work that way, unfortunately. There are a couple of problems. First, mount normally creates an association between a device and a
      Message 2 of 4 , Apr 15, 2005
      • 0 Attachment
        On Thu, 2005-04-14 at 22:50 +0000, Brian Dunphy wrote:

        > I am not sure of the correct term but I am trying to create a separate
        > mount so that I can keep my FTP users chrooted but give them read only
        > access to other directories. I went to the BusyBox site (
        > http://www.busybox.net/downloads/BusyBox.html )
        > and looked the proper way to use mount but I am still having
        > trouble.
        >
        > Here is the code I used:
        >
        > # mount /share/hdd/data/Music /share/hdd/data/Users/Zach/AlbertaMusic
        > -o ro

        Hi, Brian,

        mount doesn't work that way, unfortunately. There are a couple of
        problems. First, mount normally creates an association between a device
        and a directory which then becomes the mount-point for the filesystem
        stored on the device. You're using mount to try to connect two
        directories, as if it were ln. That's why your mount command is failing.

        Second, though it's in principle possible to mount a single device twice
        over, most normal filesystems won't function correctly this way, even if
        all but one of the mounts is readonly.

        There are probably better solutions to your problem. I would use an http
        server rather than ftp. They're easier to set up, more modern, have more
        security options, and are better suited to providing readonly access to
        files. Someone with more expertise than me in setting up ftp servers may
        be able to help you though.

        --
        Josh Parsons
        Philosophy Department
        1238 Social Sciences and Humanities Bldg.
        University of California
        Davis, CA 95616-8673
        USA

        Please avoid sending me Word or PowerPoint attachments.
        See http://www.gnu.org/philosophy/no-word-attachments.html
      • John Bowler
        From: Brian Dunphy ... You need to use the loopback filesystem - lofs. So far as I can see Linux does not support this - it has loopback devices but that
        Message 3 of 4 , Apr 15, 2005
        • 0 Attachment
          From: Brian Dunphy
          ># mount /share/hdd/data/Music /share/hdd/data/Users/Zach/AlbertaMusic -o ro

          You need to use the "loopback" filesystem - lofs. So far as I can see Linux
          does not support this - it has "loopback" devices but that puts a filesystem
          inside a file on another file system. Not what you want. SunOS has
          support, and has for a long time, but that doesn't help.

          You can 'fake' the behaviour using NFS (of course, this means you will spend
          two months trying to work out how to get NFS to work...) If you want to do
          this:

          1) Set up an NFS server on the machine (nfsd - built in to openslug,
          available as packages on unslung).
          2) Export the directory in question to localhost: /share/hdd/data/Music.
          Use 'showmount -e myslug' from some other (UNIX) machine to check this is
          correct ('localhost' will appear as the name of your slug, but you need to
          specify it as 'localhost' on the slug itself.)
          3) Mount the directory:

          mount -o ro localhost:/share/hdd/data/Music
          /share/hdd/data/Users/Zach/AlbertaMusic

          I can make this work on a standard Debian system, but I just tried it on
          unslung and can't get it to happen - I believe it's another problem with the
          somewhat ancient (last year!) NFS modules I'm using.

          BTW, with this trick you must put localhost or 127.0.0.1 in /etc/exports.
          127.0.0.1 is the IP address of 'localhost' (the 'loopback' interface -
          nothing to do with loopback file systems.) Even if you use the local IP
          address of your slug (192.168.1.77 for example) the NFS stuff is clever
          enough to use the localhost interface instead.

          If anyone gets this to work please update the wiki! (Particularly with the
          identity of the NFS modules used.)

          One catch, with a loopback mount the kernel getcwd(2) API has to make
          arbitrary choices about the full path of files within the mount - because
          there are two possible routes to each file. How this happens depends on the
          OS. On SUN OS I'm fairly sure it's arbitrary and the 'two' files are
          identical. On Linux the two files are probably *different* even though they
          are identical...

          John Bowler <jbowler@...>
        • dnihlen
          ... separate ... only ... ers/Zach/AlbertaMusic ... Hi Brian I think achieve what you re trying to do by mount -o bind /share/hdd/data/media
          Message 4 of 4 , Apr 26, 2005
          • 0 Attachment
            --- In nslu2-linux@yahoogroups.com, "Brian Dunphy" <dunphy_brian@y...>
            wrote:
            >
            > I am not sure of the correct term but I am trying to create a
            separate
            > mount so that I can keep my FTP users chrooted but give them read
            only
            > access to other directories. I went to the BusyBox site (
            > http://www.busybox.net/downloads/BusyBox.html )
            > and looked the proper way to use mount but I am still having
            > trouble.
            >
            > Here is the code I used:
            >
            > # mount /share/hdd/data/Music /share/hdd/data/Us
            ers/Zach/AlbertaMusic
            > -o ro
            > mount: Mounting /share/hdd/data/Music on
            > /share/hdd/data/Users/Zach/AlbertaMusic
            > failed: Block device required
            > #

            Hi Brian

            I think achieve what you're trying to do by

            mount -o bind /share/hdd/data/media /share/hdd/data/najlen/media

            It allows you to mount part of the file system in multiple places. I
            haven't tried to get the mount read only, instead I use file
            permissions control who can write files.

            I got my inspiration from:
            http://www.castaglia.org/proftpd/doc/contrib/ProFT
            PD-mini-HOWTO-Chroot.html

            Now I am just trying to figure out how to make this mount stick after
            a reboot, changes in fstab seems to be ignored after reboot.

            Best
            Daniel Nihlén
          Your message has been successfully submitted and would be delivered to recipients shortly.