Help with ssh -A, screen, ssh -a, detach, logout

Bob Proulx bob at proulx.com
Thu Jun 4 09:30:39 AEST 2020


Thorsten Glaser wrote:
> Bob Proulx wrote:
> 
> > You could also use "Enter ~ ." to forcibly close the connection too.
> 
> Or, when starting the connection from within a GNU screen
> tab, just press ^Ak to kill the tab.

Ah, yes, but...  In the problem description screen is running on the
remote host2 not the local host1.  In the description there is no
screen running on the local host1. :-)

I would still use ssh's tilde escape and dot command to close the
connection.  Because that works regardless of running from the screen,
tmux, an xterm, or something we didn't think of yet.  Since that works
on the ssh connection directly.

Although even though I suggested it I have a worry.  I worry that when
the connection is forcibly closed that there is still opportunity for
problems on the remote end due to the disconnect.  That's why I
suggested a completely different direction.

> > And also 'env' is an idiom for a canonical way to set or clear
> > environment variables regardless of the command line shell that anyone
> > might be using.  Because bash, ksh, zsh, csh, and all of those have
> > slightly different syntax.  But invoking 'env' this way would be
> 
> unportable (e.g. it has no -u on some BSDs), whereas unset
> in the shells is pretty well understood.

Good catch!  I don't usually need to specify -u in examples.  Normally
it is only setting environment variables.  And that works across all
of them of course.  I made a bad assumption that -u was also portable.
And it does work on FreeBSD.  But as with a lot of assumptions I
assumed wrong.  I see that it is not supported on OpenBSD or NetBSD.
I will remember that moving forward for the next time.  Thanks for the
correction. :-)

Bob



More information about the openssh-unix-dev mailing list