Bug 3477 - Support environment variable or %u token for User
Summary: Support environment variable or %u token for User
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 9.0p1
Hardware: All All
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-29 14:37 AEST by Ben Creasy
Modified: 2022-09-29 14:37 AEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Creasy 2022-09-29 14:37:35 AEST
While I realize most of the ~/.ssh/config files are bespoke, I'm trying to write a shared one for my team.

Right now I'm just leaving the User field out which means that instead of people typing ssh <server> they type ssh <user>@<server> - I'd like to save them some keystrokes. Per https://man.openbsd.org/man5/ssh_config.5#TOKENS and Env Variables section ssh_config doesn't seem to support using a variable of any type here.

However, I discovered that my Windows work computer using Git Bash for Windows (https://gitforwindows.org/), ${USERNAME} was expanding to my username properly for the User field. It says that it's running OpenSSH_8.5p1.

On my Macbook Pro running OpenSSH_9.0p1 it didn't work - ${USER} ($USERNAME is a Windows thing) ssh <host> just gives me:
${USER}@<censored> Permission denied (publickey).

On my Macbook, I cloned down the repo from https://github.com/openssh/openssh-portable and ran `git checkout V_8_5_P1` and then compiled from source. Still didn't expand the variable.

In looking at old bug/enhancement reports, I did notice https://bugzilla.mindrot.org/show_bug.cgi?id=3140 which seemed to be just about paths.