JumpSSH icon indicating copy to clipboard operation
JumpSSH copied to clipboard

Add ability to select non-interactive shell

Open hardingprofessional opened this issue 7 months ago • 0 comments

SUMMARY At the current release, jumpssh exclusively creates interactive login shells (see man bash INVOCATION section). It would be ideal if there was an option to make non-interactive non-login shells.

MOTIVATION Our environment has an echo command in the .bashrc file. The output of that echo command is included in every string returned by run_cmd. We're going to work around this by capturing our desired output as a file and getting the file, but this isn't ideal.

ADDITIONAL INFORMATION As a suggestion, I might implement this as arguments to run_cmd with the following signature:

  • interactive:bool=True specify that the command will be run in an interactive shell, defaults to True for backwards compatibility
  • login:bool=True specify that the command will be run in a login shell, default to True for backwards compatibility

Logic would need to be implemented and tested in session.py near line 282:


        my_cmd = cmd
        if username:
            user = username
            # need to run full command with shell to support shell builtins commands (source, ...)
            my_cmd = 'sudo su - %s -c "%s"' % (user, cmd.replace('"', '\\"')) #this replacement causes the user's command to be executed in an interactive login shell

hardingprofessional avatar Nov 15 '23 19:11 hardingprofessional