[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Remote terminal: xterm -e ssh <host> vs. ssh <host> xterm



On 4/28/20 8:46 AM, Steve Keller wrote:
What are best practices to create a remote terminal?  I see to ways:
Create a local terminal emulator and run ssh to the remote host in
that or call ssh to run the terminal emulator on the remote host,
i.e.

    xterm -e ssh -X <host>      or      ssh -X <host> xterm -ls

What are pros and cons?  I see one: The latter will produce more
overhead as it runs the X11 protocol through the ssh tunnel.

Steve

I have read several of the responses to this and I think it would help to clarify exactly what is happening in each of the two cases.

This is a bit long, my apologies, but to decide which is best, we need to know what is happening at all levels.

First, in both cases, you are running some sort of X based environment on your local machine.

Case one:  you run an xterm locally which uses your local environment to open a window in which an ssh is run on your local machine to open a connection to the remote host.  The sshd on the remote executes some remote application, in this case a login shell, to communicate with you.  You used the -X option to ssh so you could run an X client on the remote and it would display on your local host.

Case two:  you run ssh in your local terminal emulator, which could be any X terminal emulator (xterm, gnome-terminal, etc).  You use the -X option to allow the X protocol to communicate from the remote to the local, and you run an xterm on the remote, which then displays on your local system.  This is all handled by the same sshd that ran a shell, above.  You used the -ls option for the remote xterm, which causes it run a login shell.  If you should need to run a remote graphical program within the remote xterm, it would also open a window on your local system.

The only real difference is, as you noted, the remote xterm overhead.

Since you used the -X option of ssh, I presume you intend to run some other graphical application on the remote, so not having a remote xterm could reduce overhead from two remote graphical applications.

However, there is no reason whatsoever to run a local xterm from within a local terminal emulator, just run the ssh directly:

    ssh -X <host>

Or, if you do in fact want to run some remote graphical application:

    ssh - x <host> <remote_application>

Unless there is some specific feature of the xterm that you need, that other emulators do not supply?

Bob


Reply to: