Skip to content

Managing access to multiple iRODS zones using icommands

If you run icommands, you do not specify the zone in every command that you execute, it is specified in your irods_environment.json. It might happen that you have access to multiple zones, and that you want to switch easily between these zones. In the end you will always have to switch your irods_environment.json, but you can escape having to redo the iinit. If you haven't setup your irods_environment.json file yet, be sure to check out this section before continuing.

Multiple irods_environment.json files

Suppose you have access to YODA and the ArchvPROD iRODS systems and sometimes switch between the systems while using icommands. You can setup your ~/.irods directory in linux in the following way:

1
2
3
4
5
drwx------  2 myuser myuser 4096 Oct  1 09:52 .
drwxr-x--- 19 myuser myuser 4096 Oct  1 14:57 ..
-rw-r--r--  1 myuser myuser  582 Oct  1 13:15 irods_environment.json
-rw-r--r--  1 myuser myuser  593 Aug  7 11:44 irods_environment.json_archvPROD
-rw-r--r--  1 myuser myuser  613 Sep 29 14:41 irods_environment.json_yoda

The _yoda/_archvPROD suffix will not mean anything for iRODS itself, only the irods_environment.json file will. If you switch from yoda to ArchvPROD you can do cp ~/.irods/irods_environment.json_yoda irods_environment.json, followed by iinit. Because you still have your irods_environment.json_archvPROD file, you can just as easily switch back.

Preventing having to do iinit again

It is also possible to prevent using iinit if you have to switch between machines.

In your irods_environment.json_yoda file, you can add this line:

    "irods_authentication_file": "/home/myuser/.irods/.irodsA_yoda",

In that way, the iinit command will store the authentication tokens not in ~/.irods/.irodsA, but in ~/.irods/.irodsA_yoda. If you create a different .irodsA file for every environment you will be able to switch without using the iinit command again.

N.B.1 ~/.irods/.irodsA_yoda will not work, iRODS doesn't understand what ~ means

N.B.2 This will not prevent having to relogon when the login is expired(see iinit --ttl).