2

I have a script that I want to launch upon a successful SSH session.

So far I have this working by placing the path to my script and the script name in the .bash_profile file.

The script that I have written is text menu driven with multiple choices for the user.

One of the options is quit/exit, which I need (once selected) to exit the script and log-out user from the SSH session.

Is this possible?

I've not been able achieve this as of yet. Exiting the script is easy enough but no matter what I try I always end up with a command line prompt, which in this instance, we are trying to avoid.

Thanks In Advance,

Dan.

2
  • 2
    Use ssh-keys with a forced command, or investigate the ForceCommand option in the sshd_config file (that would be for all users though). Commented Feb 20, 2013 at 11:56
  • Stop on! Thank you so much. You can use the Match user option with this. Great job!. Commented Feb 20, 2013 at 12:49

1 Answer 1

1

Since feature requests to mark a comment as an answer remain declined, I copy the above solution here.

Use ssh-keys with a forced command, or investigate the ForceCommand option in the sshd_config file (that would be for all users though). – Carlos Campderrós

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.