Debian 10 How to get the correct permissions on a mounted drive

Discussion in 'Installation/Configuration' started by Joost De Bock, Apr 23, 2021.

  1. Joost De Bock

    Joost De Bock New Member

    I'm running a VPN Debian 10, ISPCONFIG with a mounted drive. For some reason I can't get read or write permissions working.
    This is the setup:
    Code:
    lsblk
    >      NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    >     loop0    7:0    0 61,7M  1 loop /snap/core20/975
    >     loop1    7:1    0 50,5M  1 loop /snap/certbot/1093
    >     loop2    7:2    0 99,2M  1 loop /snap/core/10958
    >     loop3    7:3    0 32,3M  1 loop /snap/snapd/11588
    >     vda    254:0    0  300G  0 disk
    >     ├─vda1 254:1    0  299G  0 part /
    >     ├─vda2 254:2    0    1K  0 part
    >     └─vda5 254:5    0  975M  0 part [SWAP]
    >     vdb    254:16   0    2T  0 disk /mnt/imageoffice-server
    
    I mounted vdb with:
    Code:
    #mkdir /mnt/imageoffice-server echo "/dev/vdX1 /mnt/imageoffice-server ext4 defaults 0 2" | tee -a /etc/fstab
    #mount /mnt/imageoffice-server
    #df -h | grep imageoffice-server
    
    returns
    Code:
    > /dev/vdb           2,0T     1,7T  231G  88% /mnt/imageoffice-server
    
    This looks good.
    Then I make some symlinks:
    Code:
    #ln -s  /mnt/imageoffice-server/archive/ web
    #ln -s  /mnt/imageoffice-server/files/ web
    
    These I can see with FTP
    I added PHP open_basedir:
    Code:
    >     /mnt/imageoffice-server:/var/www/clients/client0/web4/web
    
    I even did
    Code:
    #chmod  755 /mnt/imageoffice-server
    #chown -R 5006:5005 /mnt/imageoffice-server/
    
    In apache I added
    Code:
        <Directory /mnt/imageoffice-server>
                Options Indexes FollowSymLinks
                AllowOverride None
                Require all granted
        </Directory>
    
    Code:
    #ls -l /mnt/imageoffice-server
    
    shows
    Code:
    > drwxr-xr-x 144 web4  client0    4096 jan 23  2020 archive
    
    But after all these settings It's not possible to read or write the drive.
    What am I missing?
     
    Last edited: Apr 23, 2021
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Code:
    #mkdir /mnt/bigstorage echo "/dev/vdX1 /mnt/bigstorage ext4 defaults 0 2" | tee -a /etc/fstab
    Is that line missing line break? It would be more readable to post code in CODE tags.
    Why mkdir bigstorage and on next line mount imageoffice-server?
    Seems you have installed snap on Debian 10? Or is it actually Ubuntu 20.04? Please check.
    How are you reading and writing? What error message when it fails?
    What shows
    Code:
    mount | grep imageoffice
    Try, as root, to create a file in that mounted directory and read it back. Does this work?
     
  3. Joost De Bock

    Joost De Bock New Member

    I altered the wrong servername above.
    Code:
    mount | grep imageoffice
    /dev/vdb on /mnt/imageoffice-server type ext4 (rw,relatime)
    
    I can create files as root. Can see them in FTP but not on my website.
    FTP returns
    Code:
    553 Can't open that file: Permission denied
    When I try to write to the disk.

    Oh, snap was installed in favor of Certbot.
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Jesse Norell likes this.
  5. Joost De Bock

    Joost De Bock New Member

    The output of grep imageoffice /etc/fstab is
    Code:
    /var/log/ispconfig/httpd/xxxxxxx.org /var/www/clients/client0/web2/log    none    bind,nofail    0 0
    /var/log/ispconfig/httpd/xxxxx.xxxxxxx.org /var/www/clients/client0/web3/log    none    bind,nofail    0 0
    /dev/vdb /mnt/imageoffice-server ext4 defaults 0 2
    
    My goal is to make the content of /mnt/imageoffice-server accessible to /var/www/clients/client0/web4/web.
    For example by adding a symlink /var/www/clients/client0/web4/web/archive pointing to the contents of /mnt/imageoffice-server/archive

    In my view I connect the drive vdb to the mount imageoffice-server and the folder to the domain via symlink.
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    You have typo in /etc/fstab. The line is missing partition number, you had it in the codes you pasted at the beginning but now it is only /dev/vdb instead of /dev/vdb1 or 2 or whatever.
    A symlink only works inside a file system, it is not possible for symlink to point to another file system.
    That is wrong, it is the other way round. Hard links can not span file systems, symlinks can. Sorry for my bad.
    The tutorial I linked to uses bind mounts.
     
    Last edited: Apr 23, 2021

Share This Page