better support for Win10 OpenSSH server (#1375)

If msys2 bash is set as the DefaultShell for the Win10 OpenSSH server,
there is no way to pass -l to make it a login shell, so /etc/profile is
not sourced, PATH is not set, and the bashrc produces errors.

Detect this case in /etc/bash.bashrc, by checking for the SSH_CONNECTION
environment variable and PATH not having msys2 elements, and source
/etc/profile.
This commit is contained in:
Rafael Kitover
2018-08-07 22:46:00 -07:00
committed by Алексей
parent e350167975
commit c31f18202d
2 changed files with 7 additions and 2 deletions

View File

@@ -15,6 +15,11 @@
# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return
# If started from sshd, make sure profile is sourced
if [[ -n "$SSH_CONNECTION" ]] && [[ "$PATH" != *:/usr/bin* ]]; then
source /etc/profile
fi
# Warnings
unset _warning_found
for _warning_prefix in '' ${MINGW_PREFIX}; do