You are not logged in.

#1 2012-07-25 12:08:11

Nuteater
Member
From: Finland
Registered: 2012-07-25
Posts: 2

[SOLVED] Non-interactive SSH login and shell startup files

I have a problem getting git-annex connecting to my arch box because of
PATH not being correctly set. When diagnosing this problem I noticed that
~/.bashrc seems to be ignored for non-interactive SSH logins. More specifically,

ssh myhost env

Shows that when connecting to my other computer running gentoo, or to a
separate server (probably running some flavor of Debian, I am not sure),
environment variables defined in ~/.bashrc are present, but when connecting
to my arch box, they are not. All three computers have identical ~/.bashrc
files and ~/.bash_profile is set to read ~/.bashrc, and in all cases the file is
sourced for an interactive login (i.e., 'ssh myhost' followed by 'env'). I tried to
search through the various bash files in /etc, but didn't find anything related.

Is there some bash or SSH setting that controls this behavior?

Solution:
I looked into this a bit more and found BASH_ENV which can be used to point to
a file which is sourced for non-interactive shells. So I set

BASH_ENV=~/.bashrc

in /etc/environment, and now ~/.bashrc is sourced even for non-interactive
shells and thus my PATH is correctly set. What I still don't know is why
arch behaves differently in this respect, but I guess that will remain a mystery.

Last edited by Nuteater (2012-07-27 18:59:30)

Offline

#2 2016-05-25 18:44:37

Seeefo
Member
Registered: 2016-05-25
Posts: 1

Re: [SOLVED] Non-interactive SSH login and shell startup files

I am having this same issue.  I fixed it the same way (/etc/environment), but I did track down the difference.

Gentoo seems to compile with -DSSH_SOURCE_BASHRC flag for bash.  Arch is not using that flag when building bash.  I think this means "man bash" on arch is incorrect about bash's behavior about detecting rshd/sshd and automatically executing ~/.bashrc.

I know this is old, but I figured someone might be curious...

Offline

#3 2016-05-25 19:08:24

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Non-interactive SSH login and shell startup files

Not an issue in 2012, certainly not an issue four years later. Please don't necrobump: https://wiki.archlinux.org/index.php/Fo … bumping.22



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB