SSH FileServer Shell - Change ShellPrompt While Server is Running

0 votes
asked Jan 5, 2018 by domnwern (130 points)

First of all, I love the library, but I am running into a simple issue: whenever I change the ShellPrompt property of a running FileServer's settings, the prompt doesn't change.

Is there any way around this issue?


1 Answer

+1 vote
answered Jan 9, 2018 by Lukas Pokorny (128,250 points)

The prompt specified by FileServer.Settings.ShellPrompt is used for all new SSH shell sessions, but it does not affect existing shell sessions that were initialized with a different ShellPrompt. This is not an issue, this is by design - once a session has been established, its environment can only be changed through the session itself.

What are you actually trying to achieve? Does it indeed require manipulating the shell prompt for all existing shell sessions, or would a capability to modify environment of individual shell sessions by sufficient to achieve your goals?

commented Jan 9, 2018 by domnwern (130 points)
Thank you for the response!

I didn't know that `FileServer.Settings.ShellPrompt` was a global thing and only for new sessions. That's totally fine.

You are right that I'm trying to modify the prompt for the individual session. I want to be able to change the prompt for a user's current session based on certain commands that they type. Is there a good way to do that?

commented Jan 10, 2018 by Lukas Pokorny (128,250 points)
Thanks for the clarification. There is currently no API to achieve this, but one of the enhancements planned for the near future would actually make this possible - we would like to enhance the custom command support to make it possible for custom commands to read or change session's environment variables. If we also add a Unix-like PS1 variable to manipulate the prompt, you would be able to achieve your goal.

Because this is a rather simple feature to add, I have raised its priority. We are currently in busy finishing the next release, but when we are done with that, we'll look into this and very likely provide a beta soon. I will keep you updated.