Bug 3477

Summary: Support environment variable or %u token for User
Product: Portable OpenSSH Reporter: Ben Creasy <ben>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: enhancement    
Priority: P5    
Version: 9.0p1   
Hardware: All   
OS: All   

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.