MSYS2-packages icon indicating copy to clipboard operation
MSYS2-packages copied to clipboard

ssh can't recognize $HOME

Open ShuguangSun opened this issue 7 years ago • 5 comments

Window7, set HOME evironment variable to a path.

However, ssh can't use $HOME/.ssh/, and can only use /home/username/.ssh/ under the msys2 install folder.

Could it take $HOME?

ShuguangSun avatar Feb 12 '18 16:02 ShuguangSun

FWIW, I think this started to occur with the update to the 2.10.0 runtime, but the OpenSSH 7.6 update happended at almost the same time for me, so I'm not entirely sure.

Symptom: ~/.ssh/config is no longer found, leading to servers being unreachable due to missing configuration settings.

Workaround: cp ~/.ssh/* /home/$USERNAME/.ssh

bbolli avatar Feb 13 '18 14:02 bbolli

I have a similar issue. I usually rely on ssh locating .ssh/id_rsa.pub to use my public key to connect to remote server. Now that I changed $HOME to my Windows account's %USERPROFILE%, ssh insisted to look at /home/<username>.

The workaround I had to use is symbol link $HOME/.ssh/ to /home/<username>/.ssh. But this really sucks. It used to work beautifully.

openssh 7.6p1-2

MSYS_NT-10.0 foobar 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys

kflu avatar Feb 18 '18 01:02 kflu

Is there now any other solution than that also naively applied by myself of symlinking $HOME into /home/$USER ? There exporting $HOME is said to solve all problems, but not here.

Konfekt avatar Aug 19 '24 12:08 Konfekt

Prepend env windows to value of db_home: in /etc/nsswitch.conf

# /etc/nsswitch.conf db_home: env windows cygwin desc

https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch-home

claritystorm avatar Jun 16 '25 17:06 claritystorm

As happened here beware that /etc/nsswitch.conf can be reset by a package update

Konfekt avatar Jun 16 '25 19:06 Konfekt