You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default prompt for SSH session should include USERNAME/LOGNAME #7156
This is a suggestion that would bring PowerShell more into line with Bash. For instance, if I ssh from my Windows 10 OpenSSH enabled system to a RHEL7 box, this is the prompt I get from Bash:
PS C:\> ssh mctcbld@es-kalbuild-rh.acme.com
mctcbld@es-kalbuild-rh.acme.com's password:
Last login: Thu Jun 21 09:51:35 2018 from stacy1.acme.com
Kickstarted on 2016-02-26
[mctcbld@AD.ACME.COM@es-kalbuild-rh ~]$
This system has PowerShell Core 6.0.1 installed on it and if I open a PSSession to it, I get the hostname in the default prompt but not the username/logname. FWIW I never log into this system as myself so it is very useful to see what user I'm logged in as.
[mctcbld@es-kalbuild-rh]: PS /home/mctcbld>
# or maybe even
[mctcbld@AD.ACME.COM@es-kalbuild-rh]: PS ~>
I don't need to see the DNS suffix - just the hostname.
Finally, the docs I see for configuring powershell as a subsystem of sshd, say to use -NoProfile but then how could you configure/customize this prompt for the SSH transport?
Including the current user in the prompt seems like a personal choice. PowerShell remoting automatically prepends "[computerName]: " to the current prompt to indicate the target machine name, but does not include the current user name.
But you can easily include the user name by changing the prompt function in your remote session. Something like:
But we don't yet support configured endpoints for SSH based remoting so you would have to manually run a script file to change the prompt for each session. Once we have configured endpoints then you could simply configure the prompt with a "startup" script.
Don't you think most Linux folks would expect to see the username as well? Every Linux system I've ssh'd into shows me the username in the prompt.
What would be cool is if the remote session would display [<username>@<hostname>]: if the remote username is different than the client side username. And if they're the same, just display [<hostname>]: like it does now. :-)
Paul Higinbotham (@PaulHigin) there must be some other location for the default prompt that shows the [hostname] as modifying SetRunspacePrompt() doubles it:
Activity
iSazonov commentedon Jun 24, 2018
Paul Higinbotham (@PaulHigin) Could please comment the Issue?
PaulHigin commentedon Jun 25, 2018
Including the current user in the prompt seems like a personal choice. PowerShell remoting automatically prepends "[computerName]: " to the current prompt to indicate the target machine name, but does not include the current user name.
But you can easily include the user name by changing the prompt function in your remote session. Something like:
But we don't yet support configured endpoints for SSH based remoting so you would have to manually run a script file to change the prompt for each session. Once we have configured endpoints then you could simply configure the prompt with a "startup" script.
rkeithhill commentedon Jun 25, 2018
Don't you think most Linux folks would expect to see the username as well? Every Linux system I've ssh'd into shows me the username in the prompt.
What would be cool is if the remote session would display
[<username>@<hostname>]:if the remote username is different than the client side username. And if they're the same, just display[<hostname>]:like it does now. :-)PaulHigin commentedon Jun 25, 2018
Sure, it would be easy to do this by default. Just update the remoting prompt code.
SteveL-MSFT commentedon Jun 26, 2018
Paul Higinbotham (@PaulHigin) can you point to where in the source that prompt code exists?
PaulHigin commentedon Jun 26, 2018
EnterPSSessionCommand.SetRunspacePrompt() (PushRunspaceCommand.cs)
SteveL-MSFT commentedon Jun 26, 2018
Paul Higinbotham (@PaulHigin) there must be some other location for the default prompt that shows the [hostname] as modifying SetRunspacePrompt() doubles it:
SteveL-MSFT commentedon Jun 27, 2018
Nevermind, found it.
Update remote prompt when using ssh to show username if different (#7191
Update remote prompt when using ssh to show username if different (Po…