I use mintty as my console emulator for MinGW/MSYS. Recently (I’m not certain exactly when), the home directory used by this combination changed from my Windows user folder (
/home/<me>/, which is causing minor havoc for me.
How can I change my home directory back? I’ve done some searching online, but all of the information I’ve been able to find so far is Cygwin-specific and hasn’t translated well to MinGW/MSYS.
The most likely-looking avenues I’ve pursued so far are
/etc/nsswitch.conf, both of which are entirely absent from MSYS’ root. I’ve tried creating an
/etc/nsswitch.conf containing a
db_home: windows line, but this seemed to have no effect. I’ve not yet tried creating an
/etc/passwd file as
mkpasswd isn’t present in MinGW/MSYS and I don’t know what its contents should be.
- Windows 10 (w/ Anniversary Update)
- the latest version of all my installed MinGW and MSYS packages
- …including msys-mintty 1.0.3-1-msys-1.0.17
Unlike Cygwin, MSYS relies on the
HOME environment variable. To set or change your
- Press Win–r on your keyboard or select “Run…” from the Start menu.
- Type “sysdm.cpl” and click OK.
- Select the Advanced tab and click Environment Variables…
- Click New… to create a new
HOMEvariable or select the existing one and click Edit…
- When finished, keep clicking OK until all windows are closed.
The solution for MSYS2 is creating/updating
/etc/nsswitch.conf with a line
as described in Cygwin docs: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch-home.
After that all MSYS applications and terminals must be closed, as the configuration is only read once at MSYS DLL load time. (See https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch.)
As of Oct, 2019, it works for me in a fresh installation of MSYS2. Probably, in MSYS 1
nsswitch.conf was not supported.
HOME environment variable works for shell, but does not work for
ssh, which tries to access