net2ftp package in ISPconfig3.1RC1

Discussion in 'Plugins/Modules/Addons' started by monteros_007, Aug 27, 2016.

  1. monteros_007

    monteros_007 New Member

    Hi,
    I tested new version and I find bug. After installation net2ftp shown error_install but package only install correctly .
    upload_2016-8-27_16-18-39.png
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Installation error means that the package returned an error code and ispconfig notes it therefore as installation error. So this is not a bug in ISPConfig, its a problem in the package.
     
  3. monteros_007

    monteros_007 New Member

    Hi,
    Ok I don't know, but actually I know :) Thanks, where I can find log error?
     
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    1. What is your server combo?
    2. How do you install net2ftp?
    3. Why aren't you using version 1.0?
     
  5. oleTeacher

    oleTeacher New Member

    Know this thread is very old but desperately need to use file manger like net2ftp. Since mainly younger kids using at school, need easy way for them to edit some files.

    Think elFinder would be better but at this point settle for either.
    Anyone know of good tutorial for ISPConfig 3 and Debian Jessie for either net2ftp or elFinder?

    Tried https://www.howtoforge.com/community/threads/net2ftp-integration.42573/ and things did not go well:)
     
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I am using net2ftp on my nginx server and basically the thread you are referring is quite outdated. For instance, you do not need to edit ISPC files anymore but you just need to insert the preferred net2ftp folder name WebFTP URL (e.g. /net2ftp) in your ISPC Main Config.

    The basic guide is as follows:
    1. Create your preferred net2ftp folder name in /usr/share (or /var/www - its your choice).
    2. Create the same name in WebFTP URL in your ISPC Main Config (as said above).
    3. Download the stable 1.0 version from net2ftp site to /tmp and extract it.
    4. Move files_to_upload content to created folder.
    5. Enable it in your apache / nginx vhost for your ISPC and/or others. It should be the same as adding phpmyadmin. (Refer my sample below).
    6. Chmod net2ftp /temp/ folder to 777.
    7. Check all of your net2ftp settings to suit your need.
    8. Check it in your browser.

    My old apache config for Ubuntu 12.04. *Do modify accordingly!*
    Code:
    # netftp sample Apache configuration
    Redirect /ftp /filemanager
    Alias /filemanager /usr/share/netftp
    <Directory /usr/share/netftp>
        Options FollowSymLinks
        DirectoryIndex index.php
        # Order Deny,Allow
        # Allow from All
        <IfModule mod_php.c>
            <IfModule mod_mime.c>
                AddType application/x-httpd-php .php
            </IfModule>
            <FilesMatch ".+\.php$">
                SetHandler application/x-httpd-php
            </FilesMatch>
                    php_flag magic_quotes_gpc Off
                    php_flag track_vars On
                    php_flag register_globals Off
                    php_admin_flag allow_url_fopen Off
                    php_value include_path .
                    php_admin_value upload_tmp_dir /usr/share/net2ftp/temp
                    php_admin_value open_basedir /usr/share/net2ftp/:/etc/net2ftp/:/var/lib/net2ftp/:/usr/share/php/php-gettext/:/usr/share/javascript/
        </IfModule>
    </Directory>
    
    My current Nginx config for Ubuntu 16.04 (in ISPC vhost). *Do modify accordingly!*
    Code:
            location /filemanager {
                    root /usr/share/;
                    index index.php index.html index.htm;
                    location ~ ^/filemanager/(.+\.php)$ {
                            try_files $uri =404;
                            root /usr/share/;
                            # include /etc/nginx/fastcgi_params;
                            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                            fastcgi_param HTTPS $fastcgi_https; # <-- add this line fastcgi_paramHTTPS on;
                            fastcgi_index index.php;
                            fastcgi_param SCRIPT_FILENAME $request_filename;
                            include /etc/nginx/fastcgi_params;
                            fastcgi_param PATH_INFO $fastcgi_script_name; # <-- disabled if causing access problem
                            fastcgi_buffer_size 128k;
                            fastcgi_buffers 256 4k;
                            fastcgi_busy_buffers_size 256k;
                            fastcgi_temp_file_write_size 256k;
                            fastcgi_intercept_errors on;
                    }
                    location ~* ^/filemanager/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                            root /usr/share/;
                    }
            }
            location /file {
                    rewrite ^/* /filemanager last;
            }
    
    If you are using php7 and above, you need a minor fix from icmp github which basically involves three of its files. You may also use their copy of modified net2ftp if you know what you are doing.

    I think that is it. I may write a guide based on this later when I am free.
     
  7. oleTeacher

    oleTeacher New Member

    Thank you @ahrasis!
    Will review your info closer and see if I can get this working tomorrow.
    Let you know how it goes. Bet many people would benefit if you wrote a guide:)
    Thanks again.
     
  8. budgierless

    budgierless Member HowtoForge Supporter

    hi
    i was trying to fix an auto install script for net2fftp but im having problems modding the correct lines can anyone help?

    filename: web2ftp-install.sh
    Code:
    #!/bin/bash
    set -x
    
    # Download, unzip, and more
    cd /tmp
    wget http://www.net2ftp.com/download/net2ftp_v1.1.zip
    unzip net2ftp_v1.1.zip
    cd net2ftp_v1.1
    mv files_to_upload /var/www/webftp
    cd ..
    /bin/rm -R net2ftp_v1.1
    
    # add to webftp.conf
    echo ............. Creating /etc/apache2/conf.d/webftp.conf
    cat <<EOF>/etc/apache2/conf.d/webftp.conf
    <Directory /var/www/webftp>
    Order deny,allow
    Allow from all
    </Directory>
    Alias /net2ftp /var/www/webftp
    Alias /webftp /var/www/webftp
    EOF
    
    # Restart apache
    echo ............. Restarting apache
    /etc/init.d/apache2 restart
    
    echo ............. Creating /var/www/ispconfig/sites/site_webftp.php
    cat <<EOF>/var/www/ispconfig/sites/site_webftp.php
    <?php
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');
    \$app->auth->check_module_permissions('sites');
    if (!isset(\$_GET['id'])){
    die ("No site selected!");
    }
    \$domainId = intval(\$_GET['id']);
    \$dbData = \$app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE
    domain_id = " . \$domainId);
    \$serverId = intval(\$dbData['server_id']);
    if (\$serverId == 0){
    die ("No Server found!");
    }
    \$serverData = \$app->db->queryOneRecord(
    "SELECT server_name FROM server WHERE server_id = " .
    \$serverId);
    header('location:/webftp?servername="'.\$serverData['server_name'].'"');
    exit;
    ?>
    EOF
    
    echo ............. Setting permissions for /var/www/ispconfig/sites/site_webftp.php
    chown ispconfig:ispconfig /var/www/ispconfig/sites/site_webftp.php
    
    echo ............. Modifing line 44 /var/www/ispconfig/sites/templates/web_domain_list.htm  Backup on /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$
    cp /var/www/ispconfig/sites/templates/web_domain_list.htm /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$
    sed -i "44i<a class=\"icons16 icoWebFTP\" href=\"sites/site_webftp.php?id={tmpl_var name=\'id\'}\" target=\"webftp\"><span>{tmpl_var name=\'admin_txt\'}</span></a>" /var/www/ispconfig/sites/templates/web_domain_list.htm
    diff /var/www/ispconfig/sites/templates/web_domain_list.htm /var/www/ispconfig/sites/templates/web_domain_list.htm.bak.$$ |less
    
    
    echo ............. Adding text on line 291 /var/www/ispconfig/themes/default/css/screen/content_ispc.css  Backup on  /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$
    cp /var/www/ispconfig/themes/default/css/screen/content_ispc.css /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$
    sed -i '291i.icons16.icoWebFTP { background-image: url(\"../../icons/x16/folder_open.png\"); }' /var/www/ispconfig/themes/default/css/screen/content_ispc.css
    diff /var/www/ispconfig/themes/default/css/screen/content_ispc.css /var/www/ispconfig/themes/default/css/screen/content_ispc.css.bak.$$ |less
    
    echo ............. Commenting line 35 /var/www/webftp/settings_authorizations.inc.php Backup on /var/www/webftp/settings_authorizations.inc.php.bak.$$
    cp /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak.$$
    sed -i '35s/^/\/\/ /'  /var/www/webftp/settings_authorizations.inc.php
    sed -i '35s/$/ \/\/commented out to add webftpi\/net2ftp/'  /var/www/webftp/settings_authorizations.inc.php
    diff /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak.$$  |less
    
    echo ............. Adding text on line 34  /var/www/webftp/settings_authorizations.inc.php Backup on /var/www/webftp/settings_authorizations.inc.php.bak2.$$
    cp /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak2.$$
    
    sed -i "34i \$ftp_server=null; \n \$ftp_server=trim\(\$_GET[\'servername\'], \'\\\\\"\'\); \n if\(!strlen\(\$ftp_server\)\){ \n \$ftp_server=\$_COOKIE[\'ftp_server\']; \n } \n else{ \n setcookie\(\"ftp_server\", \$ftp_server\); \n } \n if(strlen\(\$ftp_server\)\){ \n \$net2ftp_settings[\"allowed_ftpservers\"][1] = \$ftp_server; \n } \n else{ \n \$net2ftp_settings[\"allowed_ftpservers\"][1] = \"ALL\"; \n } \n
    " /var/www/webftp/settings_authorizations.inc.php
    
    diff /var/www/webftp/settings_authorizations.inc.php /var/www/webftp/settings_authorizations.inc.php.bak2.$$  |less
    
    
     
  9. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Basically what I posted earlier already reminded that the previous guide is outdated. You should try to follow the steps I mentioned above which is done without modifying ISPC. It should be easily translated into a working script without much hassle at all.
     
  10. budgierless

    budgierless Member HowtoForge Supporter

    Ok but I had 2 issues with your steps, because of luck od detail.

    1: step 7= what needs are you taking about when you say ‘suites your needs’, ftp dose ftp right? if there are options what are they and how to apply them.
    2: if using php7 etc., must user with use distros that use php7 but also multi older PHP too, and if else in a script would of been helpful.

    Anyway, don’t miss understand me, I am very grateful but I need detail when following instructions as I am not skilled like you or having a good understanding when using code.

    Please could you make an updated apache version of your mod (maybe add screenshot too), NOTE net2ftp 1.1(June 207) is php7 ready, I do not know what that means but I’m sure you do.
     
  11. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Firstly, while posting this, I am not before my PC, so whatever posted is based on my memory.

    Secondly, you can ignore step 7 if you don't want to customize your net2ftp which basically can limit your webftp to your own domain or ip; or limit display of certain functions via modifying some of its settings files etc. This need not be in a script you are creating or else, it will be too much hassle. If you want, just echo that this can be done manually.

    Thirdly, I am using php7.1 on net2ftp v 1.0 with no problem by modifying only one of the file out the three files mentioned in the suggested edit. I think it was only the one with the browsers' things. It should work fine with lower php version but I tested it down to php 5.6 only.

    Lastly, and sadly, I cannot get net2ftp v 1.1 to work on my server, so I have no clue on how to help you on this. Do post a how to if you get it working.
     
  12. budgierless

    budgierless Member HowtoForge Supporter

    oh this is odd news, when i tested your style, i used 1.1, maybe that is way it did not work, i will try agin using 1.0, if i can still get hold of that version.
     
  13. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Updated: I got a chance to test version 1.1 just now and it seems to be working on php7.1 just fine. I really am not sure what caused it to fail last time I tried.

    So basically, just download version 1.1 via wget, unzip it, move files_to_upload to desired directory, chmod temp directory to 777, modify any of the settings files that you want (optional) and it should work just fine.

    The files i.e. settings.inc.php, settings_screens.inc.php and settings_authorizations.inc.php, is where you modify net2ftp according to your server needs. The code should be easy to understand but you can of course ask if you are not sure.
     
  14. budgierless

    budgierless Member HowtoForge Supporter

    Thanks for the update,
    I tested using version 1.0, I managed to get to the login screen but when I add ftp details the page ite page goes blank!

    I'm not sure but I think the issue is you configure maybe too old for my use?
    Ubuntu 16.04
    Webserver apache 2.4
    Php 7.0

    Note: your config says apache for ubuntu 12.04, but that is version 2.2, is that the issue, or is it a .htacess problem do you think?

    Another question: when you tested net2ftp 1.1, did you still need GitHub fix?
     
  15. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    1. I am not sure about the apache as I stopped using it and changed to nginx after upgrading to ubuntu 16.04. Basically you just need to copy phpmyadmin current code available in apps or ispconfig vhost (commented out part) and change it accordingly for your net2ftp.

    2. There is no need to fix or patch anything for version 1.1. I used wget to download it as it is. I just chmod temp folder 777 and that was it. I am using this version on nginx + ph 7.1 with the above mentioned code added to apps vhost (port 8081).
     
  16. budgierless

    budgierless Member HowtoForge Supporter

    App vhost? Please show path.
     
  17. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Sorry but don't bother about vhost for apps in apache since it is using conf file instead. Check if net2ftp provides its own conf file and symlink it to conf-available, then from there you can enable it via apache command or symlink it from there to conf-enabled.

    If it is not supplied, copy and rename phpmyadmin file then modify it accordingly. You can refer to my old sample for apache in the above post. Its conf file should have something similar. You still need to symlink it to the mentioned conf folders.

    I think the path should always be inside /etc/apache2 whether conf-available or conf-enabled.
     
  18. budgierless

    budgierless Member HowtoForge Supporter

    YES!! got it working,
    net2ftp, has no conf, so i made new version, and added config that you gave, also useing net2ftp 1.1, no extra hack/patching needed.
    thanks @ahrasis
     
    ahrasis likes this.
  19. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Congratulations! Glad to hear it's working.
     
  20. budgierless

    budgierless Member HowtoForge Supporter

    the conf for phpmyadmin has change alot since ubuntu 12.04, its not alot more code in 18.04. so net2ftp conf maybe more secuitry rick because its still got basic code from 12.04 example?
     

Share This Page