Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to select non-interactive shell #310

Open
hardingprofessional opened this issue Nov 15, 2023 · 0 comments
Open

Add ability to select non-interactive shell #310

hardingprofessional opened this issue Nov 15, 2023 · 0 comments

Comments

@hardingprofessional
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant