Menu

#111 MSYS2 ssh not finding ssh config or IdentityFile (incorrect tilde expansion when HOME env set)

1.0
open
Alexx83
None
2015-04-19
2014-11-18
Ed
No

STR:
1) Remove/rename old C:\msys64 directory.
2) Set the env variable HOME to "C:\Users\Ed" (replace for your username).
3) Ensure there is no .profile in "C:\Users\Ed" that could interfere.
4) Install msys2-x86_64-20141113.exe
5) Run msys2_shell.bat
6) $ pacman -Sy
7) $ pacman --needed -S bash pacman msys2-runtime
8) Exit the shell.
6) Run msys2_shell.bat
7) $ ssh people.mozilla.org -v

OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to people.mozilla.org [63.245.214.133] port 22.
debug1: Connection established.
Could not create directory '/home/Ed/.ssh'.
...

8) $ ssh people.mozilla.org -v -F ~/.ssh/config

OpenSSH_6.7p1, OpenSSL 1.0.1j 15 Oct 2014
debug1: Reading configuration data /c/Users/Ed/.ssh/config
debug1: /c/Users/Ed/.ssh/config line 64: Applying options for *
debug1: Connecting to people.mozilla.org [63.245.214.133] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/Ed/.ssh/foo_rsa type -1
...

9) $ ls -al ~/.ssh/config
-rw-r--r-- 1 Ed None 2072 Oct 29 12:11 /c/Users/Ed/.ssh/config

Expected result:
ssh successfully loads the config from ~/.ssh/config (which has an absolute path of /c/Users/Ed/.ssh/config).
When passed the config file using -F, ssh successfully finds the ssh key, which is referenced in the config as "~/.ssh/foo_rsa" (which has absolute path /c/Users/Ed/.ssh/foo_rsa).

Actual result:
ssh doesn't find the config at ~/.ssh/config, and can be seen trying to create a directory at "/home/Ed/.ssh".
When passed the config file using -F, ssh incorrectly expands "~/.ssh/foo_rsa" to "/home/Ed/.ssh/foo_rsa" rather than "/c/Users/Ed/.ssh/foo_rsa".

tl;dr: For some reason MSYS2's ssh expansion of "~" doesn't take into account HOME, but the |ls -al| in step 9 finds it with no problems.

Related

Tickets: #111

Discussion

<< < 1 2 (Page 2 of 2)
  • Alexx83

    Alexx83 - 2015-03-15

    Look into:
    https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-passwdinfo
    You don't need set HOME environment variable. You need modify /etc/nsswitch.conf file. Set:
    db_home: windows cygwin desc

     

    Last edit: Alexx83 2015-03-15
    • voidpointer

      voidpointer - 2015-03-15

      I want to set the HOME environment variable. If I don't, my HOME will be:

      C:\Users\Robert

      I do not want my files there.

       

      Last edit: voidpointer 2015-03-15
  • Alexx83

    Alexx83 - 2015-03-15

    It's not possible now.

     
  • voidpointer

    voidpointer - 2015-03-15

    And FYI the fstab idea didn't work, msys still generated /home directory local to its installation directory.

    I had to run mklink in msys/home to point my home directory to the location I wanted inside Dropbox.

     
  • Ray Donnelly

    Ray Donnelly - 2015-03-15

    You need to start a discussion on the Cygwin mailing list about providing the ability to use arbitrary env. variables in nsswitch.conf. That way you'd be able to do:

    db_home: %HOME

    If they agree and implement this then we'll pick it up will consider writing nsswitch.conf at install time presenting options for the most common choices.

    Also, be extremely careful with using mklink /D. If you use the MSYS2 un-installer then the symlink gets followed and your files will get removed unfortunately.

     
  • Ray Donnelly

    Ray Donnelly - 2015-03-15

    .. in the meantime you should be able to hardcode /etcnsswitch.conf with

    db_home: /e/whatever/your/favourite/home/path/is

     
  • David Macek

    David Macek - 2015-04-19

    I have updated our wiki with a pointer to Cygwin docs, so people will hopefully try to read them before raising issues with MSYS2.

    That doesn't mean the installer change won't happen; I'm just trying to provide more info for newcomers, as Ed Morley suggested.

     
<< < 1 2 (Page 2 of 2)