-2

Since I am very used to being prompted for my user-id while using putty or MobaXterm in SSH sessions I expected to have the same behaviour when using SSH in the windows terminal but that is not the case.

If I try it without specifying a user via

ssh <servername>

the command line will just use my windows user which I don't want to, since all of my hosts have too many technical users and entering them on the fly is way simpler for me than creating 3-4 a configs/profiles for each host.

I already tried creating a config file "C:\Users<my-user>.ssh\config" and played around with overwriting the "User" config via making a blank entry like

Host *
    User

which obviously didn't work.

Do you think I need to write some sort of wrapper in order to get a proper "login as:" prompt or am I just missing some simple configuration that needs to be adapted?

  • 1
    `entering them on the fly is way simpler for me than creating 3-4 a configs/profiles for each host.` Can't you just use `user@server`? – tkausl Jul 04 '22 at 07:34
  • Yes I can but since I have a lot of hosts I'd like to have just one entry for every host in my profile to keep the list tidy and overseeable – affleks Jul 04 '22 at 07:41
  • Adjust your config to a specific host and specify the user in this section. Please see the [OpenSSH Arch Wiki Entry](https://wiki.archlinux.org/title/OpenSSH#Client_usage), as this may provide a solution to your problem. – Mime Jul 04 '22 at 07:43

1 Answers1

0

Luckily I found a solution for this.

When creating a new profile I added the following line as a command:

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe /c "$login_user = Read-Host -Prompt 'login as'; ssh $login_user@<hostname>"

Replace the "<hostname>" above with whatever server you want to access.