Using Pydio In An ISPConfig 3 Multiserver Installation - Page 3

Now (re-)open the server ssh console and navigate to the webftp folder you created during pydio installation.

Edit the conf/bootstrap_repositories.php

/*
 * Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
 * This file is part of Pydio.
 *
 * Pydio is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Pydio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Pydio.  If not, see <http://www.gnu.org/licenses/>.
 *
 * The latest code can be found at <http://pyd.io/>.
 *
 * Description : configuration file
 * BASIC REPOSITORY CONFIGURATION.
 * The standard repository will point to the data path (ajaxplorer/data by default), folder "files"
 * Use the GUI to add new repositories.
 *   + Log in as "admin" and open the "Settings" Repository
 */
defined('AJXP_EXEC') or die( 'Access not allowed');

// ADMIN REPOSITORY
$REPOSITORIES["ajxp_conf"] = array(
    "DISPLAY"           =>      "Settings",
    "DISPLAY_ID"                =>      "165",
    "DESCRIPTION_ID"    =>      "506",
    "DRIVER"            =>      "ajxp_conf",
    "DRIVER_OPTIONS"=> array()
);

Open the file plugins/auth.ftp/class.ftpAuthDriver.php and search for this (around line 110):

function setFtpDataCallback($actionName, $httpVars, $fileVars){

Add this function to the class right below the "logoutCallback" function. Replace the values with yours:

       function get_ispc_host($username) {
			// connect to ispc via remoting and read ftp user
			$server = '';
			$login = '<your remote user>';
			$pass = '<your remote user password>';


			$soap_location = 'https://pathtoispconfig:8080/remote/index.php';
			$soap_uri = 'https://pathtoispconfig:8080/remote/';

			$client = new SoapClient(null, array('location' => $soap_location,

			'uri'      => $soap_uri));
			try {
				//* Login to the remote server
				if($session_id = $client->login($login,$pass)) {
				
					$check = $client->sites_ftp_user_server_get($session_id, $username);
					if($check) {
						$server = isset($check['ip_address']) ? $check['ip_address'] : $check['hostname'];
					}
					
					if($client->logout($session_id)) {
					}
				}
			} catch (SoapFault $e) {
			}
			
			return ($server != '' ? $server : 'localhost');
        }

In the same file search for the function "setFTPDataCallback" that should be right below. Add the following code to the beginning of the functions so it looks like this:

    public function setFtpDataCallback($actionName, $httpVars, $fileVars)
    {
               if(isset($httpVars['userid'])) {
                       // get host from ispconfig                      
                       $httpVars['FTP_HOST'] = $this->get_ispc_host($httpVars['userid']);
               }
        $options = array("CHARSET", "FTP_DIRECT", "FTP_HOST", "FTP_PORT", "FTP_SECURE", "PATH");
        $ftpOptions = array();
      [...]
    }

Open the file plugins/access.ftp/class.ftpAccessDriver.php and add "return true;" to the beginning of the function "isWriteable":

        public function isWriteable($path, $type="dir"){
               return true;

               $parts = parse_url($path);
               [...]
        }

Open data/plugins/boot.conf/bootstrap.json and make it look like

{
  "core.conf":{
    "USER_CREATE_REPOSITORY":false,
    "SAVE_GUEST_PREFERENCES":false,
    "SKIP_USER_HISTORY":false,
    "USERS_LIST_COMPLETE_LIMIT":"20",
    "USERS_LIST_COMPLETE_MIN_CHARS":"3",
    "USERS_LIST_HIDE_LOGIN":false,
    "ALLOW_CROSSUSERS_SHARING":false,
    "UNIQUE_INSTANCE_CONFIG":{
      "instance_name":"conf.serial",
      "group_switch_value":"conf.serial"
    }
  },
  "core.auth":{
    "ENABLE_USERS":true,
    "CASE_SENSITIVE":true,
    "ALLOW_GUEST_BROWSING":false,
    "PASSWORD_MINLENGTH":"6",
    "SESSION_SET_CREDENTIALS":true,
    "SECURE_LOGIN_FORM":false,
    "MASTER_INSTANCE_CONFIG":{
      "instance_name":"auth.ftp",
      "TRANSMIT_CLEAR_PASS":true,
      "REPOSITORY_ID":"<YOUR_VALUE>",
      "LOGIN_REDIRECT":"",
      "FTP_LOGIN_SCREEN":true,
      "AUTOCREATE_AJXPUSER":false,
      "AJXP_ADMIN_LOGIN":"",
      "group_switch_value":"auth.ftp"
    },
    "MULTI_MODE":{
      "instance_name":"MASTER_SLAVE",
      "group_switch_value":"MASTER_SLAVE"
    },
    "MULTI_USER_BASE_DRIVER":"",
    "SLAVE_INSTANCE_CONFIG":[

    ],
    "SLAVE_INSTANCE_CONFIG_group_switch":""
  }
}

Replace <YOUR_VALUE> by the md5 hash that you find in the file data/plugins/conf.serial/aliases.ser.

Open file plugins/auth.ftp/manifest.xml. You have to change some lines in there.

Around line 53:
if(el.name != "userid" && el.name!="password" && el.name != "get_action" && el.name!="login_seed"){
remove the el.name != "userid" && part so it looks like this:
if(el.name!="password" && el.name != "get_action" && el.name!="login_seed"){

Around line 79:
<div class="dialogLegend" ajxp_message_id="ftp_auth.1">AJXP_MESSAGE[ftp_auth.1]</div>
add this directly behind:
<input type="hidden" name="FTP_HOST" value=""><input type="hidden" name="FTP_SECURE" value="FALSE"><input type="hidden" name="FTP_DIRECT" value="FALSE"><input type="hidden" name="FTP_PORT" value="21"><input type="hidden" name="CHARSET" value=""><input type="hidden" name="PATH" value="/web">
so it looks like this:
<div class="dialogLegend" ajxp_message_id="ftp_auth.1">AJXP_MESSAGE[ftp_auth.1]</div><input type="hidden" name="FTP_HOST" value=""><input type="hidden" name="FTP_SECURE" value="FALSE"><input type="hidden" name="FTP_DIRECT" value="FALSE"><input type="hidden" name="FTP_PORT" value="21"><input type="hidden" name="CHARSET" value=""><input type="hidden" name="PATH" value="/web">

(If you want to grant access to the base dir instead of the web dir, e. g. if you want to access the "private" folder, too, just change the "/web" to "/" in the last hidden input field.)

Around line 82:
Remove these three lines from the file:
<tr>
<td align="right"><ajxp:message ajxp_message_id="ftp_auth.2">AJXP_MESSAGE[ftp_auth.2]</ajxp:message> </td><td colspan="3"><input type="text" name="FTP_HOST" style="width: 190px; padding:0px; margin-right: 10px;" class="dialogFocus"><ajxp:message ajxp_message_id="ftp_auth.8">AJXP_MESSAGE[ftp_auth.8]</ajxp:message>  <input type="text" name="FTP_PORT" style="width: 25px; padding:0px;" value="21"></td>
</tr>


Around line 86 (after deleting the previous lines):
Remove all 13 lines from the file. This section starts with:
<tr>
<td colspan="4">
<div class="dialogLegend" style="margin-top: 12px;" ajxp_message_id="ftp_auth.3">AJXP_MESSAGE[ftp_auth.3]</div>

and ends with
<td align="right"><ajxp:message ajxp_message_id="ftp_auth.7">AJXP_MESSAGE[ftp_auth.7]</ajxp:message> </td><td><input type="radio" name="FTP_DIRECT" style="width: 12px; padding:0px;" value="TRUE"><label style="display:inline-block;width:27px;">AJXP_MESSAGE[440]</label><input type="radio" name="FTP_DIRECT" style="width: 12px; padding:0px;" value="FALSE" checked><label style="display:inline-block;width:27px;">AJXP_MESSAGE[441]</label></td>
</tr>


Save your changes.

IMPORTANT! Now you have to clear the data cache:

rm data/cache/*.ser

Now you are finished. Once you reload your pydio login screen in the browser you will be prompted with a slightly different one than before:



You can now login with every ftp user you create inside ISPConfig, no matter on what server of your multi-server-setup it resides. Have fun.

Share this page:

19 Comment(s)

Add comment

Comments

From: Paulux

After many try.

User don't login 

Error message is : 

Cannot find user, please try again. Make sure your Caps Lock is not engaged!

 

From:

same for me :(

From:

the same :/

From: Anonymous

the same :(

From: minttux

same :((((

 

From: mjota

Same here, users can't login.

From:

I have added a note to the tutorial:

Replace the setting for REPOSITORY_ID in the bootstap file (was ISPConfigFTP) by the LOWERCASE string, that you set as name when you created your workspace (e. g. webftp).

If this does not work, have a look in the file data/plugins/conf.serial/aliases.ser and use the md5 string from there as REPOSITORY_ID.

Don't forget to clear the cache again afterwards.

From: Anonymous

Not working!

 I dont find this file: data/plugins/conf.serial/aliases.ser !!!

From:

Then you might not have used serial config storage. Maybe you used sql storage during setup.

From: Anonymous

If I used MySQL during setup, what i need to change in your code to make it work? and where I can get the md5 as you mensioned?

From:

To be honest, the easiest thing would be to simply re-install. I don't know where the md5 hash is located in MySQL installations. When following the howto, the md5 hash is in the aliases.ser file as mentioned on page 3.

From:

At first I had the error "Cannot find user, please try again. Make sure your Caps Lock is not engaged!" when trying to log in with one of my FTP user accounts created via ISPConfig 3. After some troubleshooting with Croydon, he narrowed it down to the REPOSITORY_ID value in "bootstrap.json". At least for my setup I needed not the repository name, but the md5 hash created for it in the file "data/plugins/conf.serial/aliases.ser". I cleared cache as further directed, and login was successful! I tried logging in with different users successfully, uploaded an image successfully, and edited and saved a text file successfully, all from within Pydio.

Thanks for the tutorial! I encourage others to contact the author as I did; please let him help you before leaving negative comments!

From: mmitchell

In my testing it appears that get_ispc_host always returns "localhost". I believe the issue is that the following line:

$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri));

The variable $client appears to contain no data. I am able to log into all accounts that are on the local host just not ones on a remote system.

 Is it possible I don't have some need package?

 Thanks,

mmitchell

 

From:

You need to have soap enabled in php. Maybe this isn't the case on your server.

Localhost is just a fallback if fetching the host fails to prevent pydio from displaying strange errors.

From: Anonymous

hello there,

i have an error after success login :

Loading Error : Invalid XML Document (see console)

From:

As you can see above, I had the same error upon login.
The Solution is, to my shame, to follow the howto more precisely.

Unfotunately the instructions for editing bootstrap_repositories.php are a bit unclear.
You have to remove everything betwen
defined('AJXP_EXEC') or die( 'Access not allowed');
and
// ADMIN REPOSITORY
[...]

But MOST IMPORTANTLY do not delete anything after! Then you will be put directly in your WebFTP folder whithout any error!
On my first try I simply copy pasted the content of the box, leading to a white Page, no login, nothing.
When I tried again I completely forgot to edit the file, leading to the described XML Error

From: Moddie

Hi,
I am getting that same error "Loading Error: Invalid XML Document (see console)"

Everything else seems to be working just fine, might be because it is not automatically loading
any workspace (I have to manually select from the dropdown).

also just FYI
https://pathtoispconfig:8080/
can be
https://localhost:8080/
that should work for everyone
The Following files would seem to have something to do with throwing/printing the Error,
perhaps one could work backwards from that?

[email protected]:~# grep -r -i "loading error" /usr/share/pydio/
/usr/share/pydio/conf/RELEASE_NOTE:class.remote_fsAccessDriver.php: Fix some option loading error while using the function Ajxp_PLUGIN::init(repository, options) manifest.xml: Disabling the remote_fs driver by default class.JumploaderProcessor.php: - Cross session resume implementation (doesn't work with smb) - partitioning now works with FTP - upload validation process now working for FTP and FS (details)
/usr/share/pydio/plugins/gui.ajax/res/js/ajaxplorer/class.RemoteNodeProvider.js:				if(ajaxplorer) ajaxplorer.displayMessage('ERROR', 'Loading error :'+e.message);
/usr/share/pydio/plugins/gui.ajax/res/js/ajaxplorer/class.RemoteNodeProvider.js:				else alert('Loading error :'+ e.message);
/usr/share/pydio/plugins/gui.ajax/res/js/ajaxplorer/class.RemoteNodeProvider.js:   				if(ajaxplorer) ajaxplorer.displayMessage('ERROR', 'Loading error :'+e.message);
/usr/share/pydio/plugins/gui.ajax/res/js/ajaxplorer/class.RemoteNodeProvider.js:   				else alert('Loading error :'+ e.message);


[email protected]:~# grep -r -i "invalid xml" /usr/share/pydio/
/usr/share/pydio/core/classes/sabredav/lib/Sabre/DAV/XMLUtil.php:            throw new Exception\BadRequest('The request body had an invalid XML body. (message: ' . $error->message . ', errorcode: ' . $error->code . ', line: ' . $error->line . ')');
/usr/share/pydio/plugins/gui.backbone/jquery-1.8.2.js:			jQuery.error( "Invalid XML: " + data );
/usr/share/pydio/plugins/gui.ajax/res/js/ajaxplorer/class.RemoteNodeProvider.js:		    throw new Error('Invalid XML Document (see console)');

From: Chris

Hi and thanks for this great tutorial.

This one works just fine, except for the Download cart.

If I select a folder, right click on it and choose "to selection cart" the files within this folder are successfully added to the cart tab on the left. 

Now after I try to download this cart within the zip file there are only files with no extension you cannot open. They are completly corrupted. A single file download just works fine. 

 Any ideas whats causing this?

From: strang3r

After successfull integration by following the guide I am having 2 problem on webftp. I am getting this error when I try to remove a file and it doesn't get removed:

[code]ftp_chdr() cant change directory to /empty(!): no such file or directory[/code]

I am guessing its looking for recycle_bin dir path.... but this needed to be removed asper guide.

 

And I get this error at bottom. when I do log in or log in failed:

[code]SoapClient::__doRequest(): connect() failed: Connection refused [/code]

 

I am using pydio 5.2.5 and Single server (not multie server)

 

Someone PLEASE HELP! :(