can't create root folder

Discussion in 'ISPConfig 3 Priority Support' started by jpcyrenne, Oct 10, 2014.

  1. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Good Day,

    Using latest ISPConfig on a CentOS 6.5 box

    I'm moving my customer from cPanel to ISPConfig, he has his own CMS solution and he needs an extra folder:

    root@host web1]# ll
    total 28
    drwxr-xr-x 2 web1 client1 4096 Oct 10 04:35 cgi-bin
    drwxr-xr-x 2 root root 4096 Oct 10 19:25 log
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 private
    drwxr-xr-x 2 root root 4096 Oct 10 04:58 ssl
    drwxrwx--- 2 web1 client1 4096 Oct 10 04:35 tmp
    drwx--x--x 7 web1 client1 4096 Oct 10 18:18 web
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 webdav

    [root@host web1]# pwd
    /var/www/clients/client1/web1

    [root@host web1]# mkdir web1
    mkdir: cannot create directory `web1': Permission denied

    How can I do this?

    Thank You,

    JP
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    run:

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

    jpcyrenne Member HowtoForge Supporter

    Thanks for the super and fast response.

    I changed the rights - is that the right thing to do?

    [root@host web1]# ll
    total 32
    drwxr-xr-x 2 web1 client1 4096 Oct 10 04:35 cgi-bin
    drwxr-xr-x 2 root root 4096 Oct 10 19:25 log
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 private
    drwxr-xr-x 2 root root 4096 Oct 10 04:58 ssl
    drwxrwx--- 2 web1 client1 4096 Oct 10 04:35 tmp
    drwx--x--x 7 web1 client1 4096 Oct 10 18:18 web
    drwxr-xr-x 2 root root 4096 Oct 10 20:00 web1
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 webdav
    [root@host web1]# chown web1.client1 web1

    [root@host web1]# ll
    total 32
    drwxr-xr-x 2 web1 client1 4096 Oct 10 04:35 cgi-bin
    drwxr-xr-x 2 root root 4096 Oct 10 19:25 log
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 private
    drwxr-xr-x 2 root root 4096 Oct 10 04:58 ssl
    drwxrwx--- 2 web1 client1 4096 Oct 10 04:35 tmp
    drwx--x--x 7 web1 client1 4096 Oct 10 18:18 web
    drwxr-xr-x 2 web1 client1 4096 Oct 10 20:00 web1
    drwx--x--- 2 web1 client1 4096 Oct 10 04:35 webdav

    Now I guess I'll read up on : man chattr

    JP
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, thats fine. The web1 folder should be owned by the same user and group then the web folder. This ensures that website scripts of this site and the ftp and shell users of this site can access it.
     
  5. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    So far so good. I now have 2 issues with web (apache or PHP config) and FTP.

    I finally needed these 2 folders (not web1):
    mkdir /var/www/clients/client1/web1/modules
    mkdir /var/www/clients/client1/web1/scripts
    once uploaded the content
    chown -R web1.client1 /var/www/clients/client1/web1/modules
    chown -R web1.client1 /var/www/clients/client1/web1/scripts

    1) I don't see the new folders when I connect with my FTP user

    2) I get an error with open_basedir:

    Warning: require_once(): open_basedir restriction in effect. File(/var/www/clients/client1/web1/lib/NviClassLoader.php) is not within the allowed path(s): (/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/silanis.com/web:/srv/www/silanis.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web1/web/silanis.com/public/index.php on line 11 Warning: require_once(/var/www/clients/client1/web1/lib/NviClassLoader.php): failed to open stream: Operation not permitted in /var/www/clients/client1/web1/web/silanis.com/public/index.php on line 11 Fatal error: require_once(): Failed opening required '../../../lib/NviClassLoader.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/clients/client1/web1/web/silanis.com/public/index.php on line 11

    Do I add a specific path to PHP open_basedir in ISPConfig/website/Options ?

    This is what I presently have:
    /var/www/clients/client1/web1/web:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/silanis.com/web:/srv/www/silanis.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin

    like:
    /var/www/clients/client1/web1/modules:/var/www/clients/client1/web1/scripts:

    At the end would be OK?

    Thanks,

    JP
     
  6. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    /var/www/clients/client1/web1/web:/var/www/clients/client1/web1/modules:/var/www/clients/client1/web1/scripts:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/silanis.com/web:/srv/www/silanis.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin

    didn't work? (even restarted apache in case).

    I still get my error and don't see folders in FTP

    ----------------------------------------------------------
    Also, I need these paths to be permanent in (for their CMS):
    vi /etc/httpd/conf/sites-available/silanis.com.vhost

    <VirtualHost *:80>
    DocumentRoot /var/www/clients/client1/web1/web/silanis.com/public
    ...
    <VirtualHost *:443>
    DocumentRoot /var/www/clients/client1/web1/web/silanis.com/public
    ...

    Thanks, if this works out well, I will have a few sites to transfer afterwards.

    JP
     
  7. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    3) How do I create a symlink that works in suPHP? I can't 'su web1'

    # pwd
    /var/www/clients/client1/web1/web/silanis.com/public

    lrwxrwxrwx 1 root root 42 Oct 10 23:01 info2.php -> /var/www/clients/client1/web1/lib/info.php
    lrwxrwxrwx 1 root root 42 Oct 10 22:59 info.php -> /var/www/clients/client1/web1/lib/info.php

    I can't chmod, chown or chgrp. I get a 500 error Probably normal with 777

    Thanks,

    JP
     
  8. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Sorry, I know this is getting a bit heavy. I want to avoid opening different tickets and I post as I find solutions so you don't work for nothing.

    Here's a recap...

    I created 3 new folders for a customer's CMS:
    mkdir /var/www/clients/client1/web1/lib
    mkdir /var/www/clients/client1/web1/modules
    mkdir /var/www/clients/client1/web1/scripts

    1) I still can't see the new folders I created (lib, modules, scripts) in FTP? Is there something to change in pure-ftpd?

    2) My PHP open_basedir seems fixed with this:
    /var/www/clients/client1/web1:/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/lib:/var/www/clients/client1/web1/modules:/var/www/clients/client1/web1/scripts:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/silanis.com/web:/srv/www/silanis.com/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin

    fixed a Zend path issue with an include_path in 'Web Domain/Options/Custom php.ini settings'


    Also, I need this paths to be permanent in (for their CMS):
    vi /etc/httpd/conf/sites-available/silanis.com.vhost

    <VirtualHost *:80>
    DocumentRoot /var/www/clients/client1/web1/web/silanis.com/public
    ...
    <VirtualHost *:443>
    DocumentRoot /var/www/clients/client1/web1/web/silanis.com/public
    ...

    Can it be fixed with 'Apache Directives' in Web Domains/Options?
    I usually lose /silanis.com/public


    3) How to create symlink? See previous Post.

    Thank You once again,

    JP
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    ensure that they are owned by the web user and client group of that website.

    Never edit the vhost file directly. Put the:

    DocumentRoot /var/www/clients/client1/web1/web/silanis.com/public

    line in the apache directives field.

    3) Symlinks in Linux are created with the ln -s command. example:

    ln -s /target /link
     
  10. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Thank you. It's all good now.

    Must have been a refresh issue with my FTP client? I did refresh even close and reconnect it wouldn't work? It's OK today.

    I added the DocumentRoot and path to the Apache Directives.

    ---------
    For the symlink, i can only create it as root. Is this OK? How can I create it as the web user if he doesn't exist?

    Go from:

    lrwxrwxrwx 1 root root 42 Oct 10 23:01 info2.php -> /var/www/clients/client1/web1/lib/info.php

    lrwxrwxrwx 1 root root 21 Oct 13 18:22 info3.php -> ../../../lib/info.php

    to:

    lrwxrwxrwx 1 web1 client1 42 Oct 10 23:01 info2.php -> /var/www/clients/client1/web1/lib/info.php

    I seem to be getting 500 errors (suPHP) with this. Wether I use a relative or absolute path? Could it be the user or rights (not 640 or 755)

    Thanks,

    JP
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    First of all, suphp is deprecated and will get removed soon, do not use suphp for any new website. The recommended php mode are php-fcgi or php-fpm together with suexec enabled.

    Regarding 500 error, check the error.log of the website to see the reason.
     

Share This Page