l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2002 Jul 25 16:07

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] checking for interactive shell in bash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] checking for interactive shell in bash



Peter Jay Salzman writes:
 > begin Micah Cowan <micah@cowan.name> 

 > > Pete, I'm not sure I understand - /etc/profile and all the other bash
 > > init scripts (e.g., ~/.bash_profile and ~/.bashrc) are never run under
 > > a noninteractive invocation (cf. the man page), unless --login was
 > > specified. There should be no need for this test.
 >  
 > that was my understanding, but my system begs to differ.
 > 
 > as a test, i put
 > 
 >    echo "blah"
 > 
 > in /etc/profile.  i then went to lucifer and scp'd something from
 > satan.  i saw "blah".  you can try it for yourself.
 > 
 > if you have an explanation for why i saw "blah" during scp, i'd be all
 > ears!  i just assumed the man page was wrong (it happens).

I am almost certain that the man page is correct - because other
programs which invoke noninteractive sessions do not run
/etc/profile. Which leaves one remaining possibility: scp doesn't run
noninteractive shell sessions.

After peeking at the source, it's interesting to note that scp is
absolutely nothing more than a wrapper that calls ssh, which handles
the real work. It seems very likely that ssh has no noninteractive
mode (I can't find one in the man page), so that would certainly cause
this problem.

...I just confirmed this by performing a similar test to the one you
describe above. When I run bash -c, ~/.bashrc is not loaded (and,
presumably, neither are any others). However, when I run ssh with a
command, it gets run. ssh always invokes a login shell, it seems.

It may not necessarily be ssh's fault - it might be something to do
with the PAM modules, if it was compiled with support.

-Micah
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.