KBEC-00039 - Apache and ElectricCommander session ID under Linux

Description

When creating your own GUI using Apache, you may want to use ElectricCommander ectool commands. The ectool login command fails when executed as Apache under Linux with the following response:


"Login failed. ["Couldn't write session file: Permission denied"]"

Background

ectool login, by default, creates in the user's Home directory a .ecsession file containing the session ID, or token.

The token is:

  1. Held on the Commander server
  2. Expired on the Commander server after:
    1. 72 hours (3 days) of no use. Using the token resets the timer.
    2. each server restart
  3. Stored on the client in a file in a directory that is unique to:
    1. the OS user - each user has a unique .ecsession file
    2. the host - can have a different .ecsession file on a different host
    3. the Commander server - each session to a different Commander server has a different token

The default .ecsession file is located in the user's space.

  1. On Windows
    1. Windows Vista, Windows7, by default, for user "build": "C:\Users\build\AppData\Local\Electric Cloud\ElectricCommander"
    2. Windows XP and 2003 by default, for user "build": "C:\Documents and Settings\build\Local Settings\Application Data\Electric Cloud\ElectricCommander".
  2. On Linux, by default, "~/.ecsession".

Solution

The issue is that processes running as "nobody", such as those started by Apache, do not have write access to their own Home directory.

ectool has a means to override this location by using the environment variable COMMANDER_SESSIONFILE, which can direct ectool to store the session file in a different location.

Example

Use the following code to set an alternate session ID location and check the result of the ectool login command.


$ectool = "/opt/electriccloud/electriccommander/bin/ectool \--server $ecserver ";
putenv("COMMANDER_SESSIONFILE=/tmp/tmpsession");
$cmd = "$ectool login admin changeme";
$login_output = system($cmd, $return_code);
echo "Login Successful? <br />";
echo " Ouput = $login_output <br />";
echo " Return Code = $return_code <br />";
Have more questions? Submit a request

Comments

Powered by Zendesk