making directory to link to hdd

Discussion in 'ISPConfig 3 Priority Support' started by kwickcut, Mar 27, 2018.

  1. kwickcut

    kwickcut Member

    this is how i did it in the past on ubuntu 10.04 now using ububtu 16.04

    i have tried to make a directory to link to a hdb1 so i have tried the following

    Code:
    mkdir /var/www/clients/client1/web1/ftp
    and i get the following responce
    Code:
    mkdir: cannot create directory ‘/var/www/clients/clientX/webX/ftp’: Permission denied
    so then i decided to use an existing directory private
    Code:
    mkdir /var/www/clients/client1/web1/private/ftp
    then i ran the following to find uudi
    Code:
    ls -l /dev/disk/by-uuid
    i then edit /etc/fstab something like
    Code:
    UUID=1d4125f0-f1eb-4a6c-b666-dd2fe4845d2a /var/www/clients/clientX/webX/private/ftp ext4 defaults 1 2
    then i mounted the directory
    Code:
    mount sdb1 /var/www/clients/clientX/webX/private/ftp
    then i ran
    Code:
    df
    and the output is
    Code:
    /dev/sdb1                         976759804  118132 976641672   1% /var/www/clients/clientX/webX/private/ftp
    so everything seems top be correct the directory is 777 when i log into the ftp i can not access the link to the drive i get
    Response: 550 Can't change directory to ftp: Permission denied

    i also tried directory webdav with the same outcome. i do not want to make a folder inside of the web directory i need it to be outside if the web directory..

    thanks for any help

    kwick
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ls -la /var/www/clients/client1/web1/private

    using the private folder for that is fine, that's the intended location for that purpose. But you can also create that folder in the root of the website like this:

    chattr -i /var/www/clients/client1/web1
    mkdir /var/www/clients/client1/web1/ftp
    chattr +i /var/www/clients/client1/web1
     
  3. kwickcut

    kwickcut Member

    output of ls -la /var/www/clients/client1/web1/private

    total 12
    drwx--x--- 3 web1 client1 4096 Feb 7 17:05 .
    drwxr-xr-x 10 root root 4096 Feb 6 23:24 ..
    dr-x------ 1 root root 4096 Mar 26 21:52 ftp
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The ftp directory is readable by the root user only, no write permissions and no permission for the web user, so the web user can neither read nor write that directory. Try this:

    chown web1:client1 /var/www/clients/client1/web1/private/ftp
    chmod 751 /var/www/clients/client1/web1/private/ftp
     
  5. kwickcut

    kwickcut Member

    ok so i tried you way and could make the directory. thank you for the help

    chattr -i /var/www/clients/client1/web1
    mkdir /var/www/clients/client1/web1/ftp
    chattr +i /var/www/clients/client1/web1

    this is the output of
    ls -la /var/www/clients/client1/web1/ftp
    total 8
    dr-x------ 1 root root 4096 Mar 26 21:52 .
    drwxr-xr-x 11 root root 4096 Mar 27 14:49 ..
    dr-x------ 1 root root 0 Mar 26 21:52 $RECYCLE.BIN
    dr-x------ 1 root root 0 Mar 26 21:52 System Volume Information

    what i noticed is when the directory ftp is not mounted the permissions are 777, once i mount the drive they change to 500 and can not be changed..


    thank you for the help


    kwick
     
  6. kwickcut

    kwickcut Member

    no change still 500

    chown web1:client1 /var/www/clients/client1/web1/ftp chown: changing ownership of '/var/www/clients/client1/web1/ftp': Read-only file system
    chmod 751 /var/www/clients/client1/web1/ftp
    chmod: changing permissions of '/var/www/clients/client1/web1/ftp': Read-only file system

    ls -la /var/www/clients/client1/web1/ftp
    total 8
    dr-x------ 1 root root 4096 Mar 26 21:52 .
    drwxr-xr-x 11 root root 4096 Mar 27 14:49 ..
    dr-x------ 1 root root 0 Mar 26 21:52 $RECYCLE.BIN
    dr-x------ 1 root root 0 Mar 26 21:52 System Volume Information
     
    Last edited: Mar 27, 2018
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The place where you create the directory does not matter. The problem is related to the permissions, a directory owned by root:root with permissions so only root can read it and not even write it is not accessible. Try to mount the partition in rw mode instead of read only mode.
     
  8. kwickcut

    kwickcut Member

    issue resolved.. i was unaware that the drive was ntfs and not ext4..
    so to fix this i did the following

    fdisk -l
    fdisk /dev/sdb
    d ...to delete the current partition
    n ...to create a new partition
    p ...to specify it as a PRIMARY partition
    1 ...to set it as the 1ST primary partition
    w ...to write the changes.
    w ...quit fdisk
    then i did the following
    fdisk -l to check the drive
    mkfs -t ext4 /dev/sdb1
    y ... to overwrite ntfs
    mount /dev/sdb1 var/www/clients/client1/web1/ftp

    i then set the permissions like stated above
    chown web1:client1 /var/www/clients/client1/web1/ftp
    chmod 757 /var/www/clients/client1/web1/ftp

    then everything worked

    thank you foe everything


    kwick
     
    till likes this.

Share This Page