See the document titled How to open an SSH session from within a SLAX script in the Junos Space Resources section of the TechWiki.This solution applies to Junos Space 13.2 and later.