Skip to content

Add ability to select non-interactive shell #310

@hardingprofessional

Description

@hardingprofessional

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions