Skip site navigation (1)Skip section navigation (2)
Date:      03 Jul 2000 16:10:53 -0700
From:      Harry Putnam <reader@newsguy.com>
To:        freebsd-mobile@FreeBSD.ORG
Cc:        "Kevin Oberman" <oberman@es.net>
Subject:   Re: X-display from laptop to desk
Message-ID:  <m2puouajya.fsf@reader.ptw.com>
In-Reply-To: "Kevin Oberman"'s message of "Mon, 03 Jul 2000 12:24:52 -0700"
References:  <200007031924.e63JOqn08344@ptavv.es.net>

next in thread | previous in thread | raw e-mail | index | archive | help
"Kevin Oberman" <oberman@es.net> writes:

> > Date: Sat, 1 Jul 2000 18:13:55 -0700 (PDT)
> > From: Jason Fesler <jfesler@gigo.com>
> > Sender: owner-freebsd-mobile@FreeBSD.ORG
> > 
> > > If I su to root on the remote, I can no longer run anthing that needs
> > > X.  For example:
> > 
> > That's because your authentication changed.
> > 
> > What we do at work i  "ssh root@localhost", give the root password,
> > and a new set of X forwarding is created.  At this point you can
> > now run X apps as root.
> 
> While this works fine, it moves the IPC from the "local" connect to a
> "network" connect which is far less efficient.
> 
> A better solution to this is to redefine the XAUTHORITY variable
> to point at your X login .Xauthority file.
> 
> For sh and sons:
> XAUTHORITY=/home/jfesler/.Xauthroity
> export XAUTHORITY
> 
> For csh and children:
> setenv XAUTHORITY ~jfesler/.Xauthority


This seems like a good solution.. and works fine.  Still one little
wrinkle here.   First a quick description of what I'm doing:

All shells on local and remote are running bash  1.14.7(1) .

From an X session on a Redhat Linux box, as user reader, I start an
xterm with `ssh-agent xterm' then in that xterm `ssh-add' to add the
ssh agent authorization.  All further business is from this xterm.

Setting the remote to XAUTHORITY=/home/reader/.Xauthority does the
magic so far as suing to root.  Nice solution... thanks.

Logon directly to laptop running FreeBSD as user reader.  The laptop
has a TERM setting in  ~/.bash_profile: TERM=${TERM:-cons25}.  I don't
recognize that particular syntax but I took it from stock install
files.

echo $TERM
cons25

Now logging in remotely via ssh
$ echo $TERM
xterm

Apparently the calling ssh xterm has brought its own env settings.

This causes some unexpected escape characters to appear in certain
apps.  vim inparticular.  Shows `<Esc>[39m~' when opening a file.  The
file is displayed so it isn't a huge problem but just annoying.

Resetting the remote term to TERM=cons25 makes this disappear and
allows normal displays.

How can I automatically reset the env variable when sshing in?

Does the recieving shell make note of the fact that it is called by
ssh?  Maybe allowing one to write an:

if [ var = ssh  ];then
  TERM=cons25
  export TERM
 fi


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




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