Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Aug 2004 20:46:13 -0700
From:      Gary Kline <kline@tao.thought.org>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: How can I tell if I'm ssh'd into a host?
Message-ID:  <20040823034613.GC61085@thought.org>
In-Reply-To: <20040823030848.GA70547@dan.emsphone.com>
References:  <20040822224148.GA60895@thought.org> <20040823030848.GA70547@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 22, 2004 at 10:08:48PM -0500, Dan Nelson wrote:
> In the last episode (Aug 22), Gary Kline said:
> > This is a strange one.  On different hosts in my ~/.zlogin, I test
> > for `hostname` = HOST.thought.org
> > 
> > If true, I do certain things such as set xhost FOO and xmodmap
> > ~/.xmodmaprc...  I've noticed that with my 5-CURRENT on my laptop, I
> > get complains from xhost and naturally, xmodmap.
> > 
> > Is there a way of asking where I am on the console/KVM, or remote and
> > ssh'd?  Sorry if I''m not explaining this well.  --I didn't notice
> > these complains when I had 4.10 on my laptop.  Aside from having
> > .zlogin prompt: "Are you ssh'd in? [y/[n]] " I'm drawing a blank.
> 
> It sounds like you really want to know whether you're running under X
> or not, since you mention xhost errors.  If you ssh in from a console
> login, xhost/xmodmap will still complain :)  You can test to see if
> $DISPLAY is set to see whether you're connecting from an X session.
> 
> if [ $+DISPLAY -eq 1 ] ; then
>   # do X stuff
> fi
> 

	Yep, this works too.  Thanks duly noted to you and Giorgos
	Keramid for both examples.  These are going to come in
	handy as my network grows!

	gary


-- 
   Gary Kline     kline@thought.org   www.thought.org     Public service Unix



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040823034613.GC61085>