KBEC-00264 - Using ectool login and a sudo session

Article ID:360032828732
1 minute readKnowledge base
On this page

Summary

The ectool login step is a necessary step when desiring to run Commander commands from the command line. Trying to combine it with the sudo command can cause errors however.

On Linux, a user logs in as themselves, and does an ectool login, then uses the sudo command to run an ectool import, but it fails:

$  ./ectool --server <server-name> login admin
Password:
<response requestId="1">
<sessionId>FMPTSTIAH9ZHGU2W</sessionId>
<userName>admin</userName>
</response>

$ sudo ./ectool import --file "/tmp/procedure1.xml" --path "/projects/project1/procedures/Procedure1" --force true
ectool error [ExpiredSession]: Session has expired

Solution

The ectool login session is dependent on the shell login, so if you log in as your individual user, and then run the ectool command with the sudo command, you are in the "root" session, which does not have the login session. You do not need to use the sudo command with your ectool import command. If your Commander user has the correct permissions, you will be able to run the import command.