Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #70911

Re: OT? using screen via ssh

From Alan Baker <alangbaker@telus.net>
Newsgroups comp.sys.mac.system
Subject Re: OT? using screen via ssh
Date 2015-03-11 13:40 -0700
Organization Datemas.de http://www.news.datemas.de
Message-ID <mdq98g$9jj$1@news.datemas.de> (permalink)
References <slrnmfupm2.1fib.g.kreme@kreme.eternal-september.org> <barmar-F9D6CE.12344511032015@88-209-239-213.giganet.hu> <slrnmg15ld.2870.g.kreme@kreme.eternal-september.org> <mdq7lb$6ma$1@news.datemas.de> <barmar-EBF0EE.16325811032015@88-209-239-213.giganet.hu>

Show all headers | View raw


On 2015-03-11 20:32:58 +0000, Barry Margolin said:

> In article <mdq7lb$6ma$1@news.datemas.de>,
>  Alan Baker <alangbaker@telus.net> wrote:
> 
>> On 2015-03-11 19:24:47 +0000, Lewis said:
>> 
>>> Okay, so one time? In band camp? Barry Margolin <barmar@alum.mit.edu>
>>> was all, like:
>>>> In article <slrnmfupm2.1fib.g.kreme@kreme.eternal-september.org>,
>>>> Lewis <g.kreme@gmail.com.dontsendmecopies> wrote:
>>> 
>>>>> I use ssh in to my computers frequently, and I usually launch screen so
>>>>> I can reattach to my shells from different machines.
>>>>> 
>>>>> alias ssh1='ssh -t user@server.local screen -h 5000 -DRRS server'
>>>>> alias ssh2='ssh -t user@imac.local screen -h 5000 -DRRS imac'
>>>>> 
>>>>> But what I have found is that if I actually go to detach the screen
>>>>> session via ctrl-a, d it not only detaches the screen session, but also
>>>>> disconnects from the ssh session. So instead of being in the shell on
>>>>> the remote machine, i am back in the shell on the local machine.
>>>>> 
>>>>> I can do the command in two steps:
>>>>> 
>>>>> $ ssh user@imac.local
>>>>> $ screen -DRRS -h 5000 imac
>>>>> 
>>>>> And then when I detach the screen, I get back to the ssh prompt on the
>>>>> remote machine.
>>>>> 
>>>>> Is there anyway to setup the alias command above so that detaching will
>>>>> drop me to the ssh on the remote machine?
>>> 
>>>> alias ssh1='ssh -t user@server.local "screen -h 5000 -DRRS server; bash"'
>>> 
>>>> This runs screen, and when it exits it runs bash.
>>> 
>>> True, but it runs a different instance of bash than the one that ran
>>> screen in the first place.
>>> 
>>> tmux sounds interesting.
>> 
>> I don't think there is an instance of bash that ran "in the first place".
>> 
>> Straight from the Mac OS X (Mavericks/10.9.4) ssh man page:
>> 
>> " If command is specified, it is executed on the remote host INSTEAD of
>> a login shell."
> 
> But it's clearly being executed through a non-interactive shell.
> Otherwise, my method of specifying multiple commands wouldn't work.

True. But I was answering the point that was raised.

ssh, sshd and perhaps the login utility are clearly involved in 
allowing you to run an initial command that can be a multiple command, 
but absent that multiple, they run the one command specified ("screen") 
and then when you exit that, end the session.

Back to comp.sys.mac.system | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OT? using screen via ssh Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-10 21:48 +0000
  Re: OT? using screen via ssh billy@MIX.COM - 2015-03-11 04:33 +0000
    Re: OT? using screen via ssh Jolly Roger <jollyroger@pobox.com> - 2015-03-11 14:10 +0000
    Re: OT? using screen via ssh tmo1138 <tmo1138@tmo1138.org> - 2015-03-11 15:11 -0700
  Re: OT? using screen via ssh Barry Margolin <barmar@alum.mit.edu> - 2015-03-11 12:34 -0400
    Re: OT? using screen via ssh Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-11 19:24 +0000
      Re: OT? using screen via ssh Alan Baker <alangbaker@telus.net> - 2015-03-11 13:13 -0700
        Re: OT? using screen via ssh Jolly Roger <jollyroger@pobox.com> - 2015-03-11 20:22 +0000
          Re: OT? using screen via ssh Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-11 20:48 +0000
            Re: OT? using screen via ssh Alan Baker <alangbaker@telus.net> - 2015-03-11 14:00 -0700
              Re: OT? using screen via ssh Jolly Roger <jollyroger@pobox.com> - 2015-03-11 21:08 +0000
                Re: OT? using screen via ssh Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-12 12:53 +0000
                Re: OT? using screen via ssh Jolly Roger <jollyroger@pobox.com> - 2015-03-12 12:57 +0000
                Re: OT? using screen via ssh Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-12 13:29 +0000
        Re: OT? using screen via ssh Barry Margolin <barmar@alum.mit.edu> - 2015-03-11 16:32 -0400
          Re: OT? using screen via ssh Alan Baker <alangbaker@telus.net> - 2015-03-11 13:40 -0700
      Re: OT? using screen via ssh Barry Margolin <barmar@alum.mit.edu> - 2015-03-11 16:32 -0400

csiph-web