1

I'm running a script that's determining login information for me, and in the end is outputting the login information that I need to use.

I am running the script in a terminal, and now I want it to SSH me with the credentials it has, exit the Python script on my computer and connect my current terminal to the new server.

Say I already have my sshHost, sshUser and sshPass as variables in the script. How do I run an SSH command in the current terminal and connect to that server?

I tried subprocess and spur, however I didn't really manage to get that going.

I would really appreciate your help and thanks in advance.

1
  • 1
    I've written a simple tool which did exactly what you want, you can take a look at it. sshhelper Commented Jul 18, 2015 at 3:24

1 Answer 1

1

assuming the python prints the settings to stdout;

#!/bin/sh
export $(credentials.py)
exec ssh hostname
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.