Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.mac.system > #70828 > unrolled thread
| Started by | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| First post | 2015-03-10 21:48 +0000 |
| Last post | 2015-03-11 16:32 -0400 |
| Articles | 17 — 6 participants |
Back to article view | Back to comp.sys.mac.system
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
| From | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| Date | 2015-03-10 21:48 +0000 |
| Subject | OT? using screen via ssh |
| Message-ID | <slrnmfupm2.1fib.g.kreme@kreme.eternal-september.org> |
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? -- http://2blog.kreme.com If the laws of action and reaction had anything to do with it, it should have flopped to the ground a few feet away. But no-one was listening to them.
[toc] | [next] | [standalone]
| From | billy@MIX.COM |
|---|---|
| Date | 2015-03-11 04:33 +0000 |
| Message-ID | <mdogja$gk$1@reader2.panix.com> |
| In reply to | #70828 |
Lewis <g.kreme@gmail.com.dontsendmecopies> writes:
> Is there anyway to setup the alias command above so that detaching will
> drop me to the ssh on the remote machine?
https://danielmiessler.com/study/tmux/
Billy Y..
--
sub #'9+1 ,r0 ; convert ascii byte
add #9.+1 ,r0 ; to an integer
bcc 20$ ; not a number
[toc] | [prev] | [next] | [standalone]
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Date | 2015-03-11 14:10 +0000 |
| Message-ID | <cmb0mkFb9dlU5@mid.individual.net> |
| In reply to | #70855 |
On 2015-03-11, billy@MIX.COM <billy@MIX.COM> wrote: > Lewis <g.kreme@gmail.com.dontsendmecopies> writes: > >> Is there anyway to setup the alias command above so that detaching will >> drop me to the ssh on the remote machine? > > https://danielmiessler.com/study/tmux/ Neat. Thanks, Billy. -- E-mail sent to this address may be devoured by my ravenous SPAM filter. I often ignore posts from Google. Use a real news client instead. JR
[toc] | [prev] | [next] | [standalone]
| From | tmo1138 <tmo1138@tmo1138.org> |
|---|---|
| Date | 2015-03-11 15:11 -0700 |
| Message-ID | <mdqegb$6d8$1@dont-email.me> |
| In reply to | #70855 |
On 3/10/15 9:33 PM, billy@MIX.COM wrote: > Lewis <g.kreme@gmail.com.dontsendmecopies> writes: > >> Is there anyway to setup the alias command above so that detaching will >> drop me to the ssh on the remote machine? > > https://danielmiessler.com/study/tmux/ > > Billy Y.. > Totally awesome. Thank you for sharing that. -- "The trouble with quotes on the internet is that you can never know if they are genuine". - Abraham Lincoln
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2015-03-11 12:34 -0400 |
| Message-ID | <barmar-F9D6CE.12344511032015@88-209-239-213.giganet.hu> |
| In reply to | #70828 |
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. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [next] | [standalone]
| From | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| Date | 2015-03-11 19:24 +0000 |
| Message-ID | <slrnmg15ld.2870.g.kreme@kreme.eternal-september.org> |
| In reply to | #70886 |
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. -- http://2blog.kreme.com I'm just going to go home, lie down, and listen to country music. The music of pain.
[toc] | [prev] | [next] | [standalone]
| From | Alan Baker <alangbaker@telus.net> |
|---|---|
| Date | 2015-03-11 13:13 -0700 |
| Message-ID | <mdq7lb$6ma$1@news.datemas.de> |
| In reply to | #70899 |
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."
[toc] | [prev] | [next] | [standalone]
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Date | 2015-03-11 20:22 +0000 |
| Message-ID | <cmbmg0Fg4rvU6@mid.individual.net> |
| In reply to | #70905 |
On 2015-03-11, Alan Baker <alangbaker@telus.net> wrote: > On 2015-03-11 19:24:47 +0000, Lewis said: > >> 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." Naturally. I use screen a lot on remote computers, and it's no effort at all to first establish an ssh connection to get a shell and then run screen afterward. -- E-mail sent to this address may be devoured by my ravenous SPAM filter. I often ignore posts from Google. Use a real news client instead. JR
[toc] | [prev] | [next] | [standalone]
| From | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| Date | 2015-03-11 20:48 +0000 |
| Message-ID | <slrnmg1aiu.2870.g.kreme@kreme.eternal-september.org> |
| In reply to | #70908 |
Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was all, like: > On 2015-03-11, Alan Baker <alangbaker@telus.net> wrote: >> On 2015-03-11 19:24:47 +0000, Lewis said: >> >>> 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." > Naturally. I use screen a lot on remote computers, and it's no effort at > all to first establish an ssh connection to get a shell and then run > screen afterward. That is probably what I will end up doing. -- http://2blog.kreme.com “The chief obstacle to the progress of the human race is the human race. ” ― Don Marquis
[toc] | [prev] | [next] | [standalone]
| From | Alan Baker <alangbaker@telus.net> |
|---|---|
| Date | 2015-03-11 14:00 -0700 |
| Message-ID | <mdqado$bip$1@news.datemas.de> |
| In reply to | #70912 |
On 2015-03-11 20:48:47 +0000, Lewis said: > Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was > all, like: >> On 2015-03-11, Alan Baker <alangbaker@telus.net> wrote: >>> On 2015-03-11 19:24:47 +0000, Lewis said: >>> >>>> 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." > >> Naturally. I use screen a lot on remote computers, and it's no effort at >> all to first establish an ssh connection to get a shell and then run >> screen afterward. > > That is probably what I will end up doing. Just add a command to execute screen in one of "~/.bash_profile", "~/.bash_login", or "~/.profile".
[toc] | [prev] | [next] | [standalone]
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Date | 2015-03-11 21:08 +0000 |
| Message-ID | <cmbp6iFhvu1U1@mid.individual.net> |
| In reply to | #70913 |
On 2015-03-11, Alan Baker <alangbaker@telus.net> wrote:
> On 2015-03-11 20:48:47 +0000, Lewis said:
>
>> Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was
>> all, like:
>>> On 2015-03-11, Alan Baker <alangbaker@telus.net> wrote:
>>>> On 2015-03-11 19:24:47 +0000, Lewis said:
>>>>
>>>>> 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."
>>
>>> Naturally. I use screen a lot on remote computers, and it's no effort at
>>> all to first establish an ssh connection to get a shell and then run
>>> screen afterward.
>>
>> That is probably what I will end up doing.
>
> Just add a command to execute screen in one of "~/.bash_profile",
> "~/.bash_login", or "~/.profile".
This isn't what Lewis wants, but I have this code in my shell startup
files (.bashrc) that shows me a list of available screen sessions when I
have one or more already running during login:
# login greeting for screen
if [ "$TERM" = "screen" -a ! "$SHOWED_SCREEN_MESSAGE" = "true" ];
then
echo "[ screen is currently active ]"
export SHOWED_SCREEN_MESSAGE="true"
fi
detached_screens=`screen -list | grep Detached`
if [ ! -z "$detached_screens" ]; then
echo ""
echo " Detached screens are available:"
echo ""
echo " PID.TTY.HOST STATUS"
echo " ----------------------------------"
echo "$detached_screens"
echo ""
echo " To reattach, type: screen -r pid.tty.host "
echo ""
fi
The resulting output looks like this:
# ssh server
Last login: Wed Mar 11 14:07:12 2015
Detached screens are available:
PID.TTY.HOST STATUS
----------------------------------
37134.ttys001.server (Detached)
To reattach, type: screen -r pid.tty.host
#
Caveat: This can interfere with some utilities like sftp, rsync, etc if
they do not expect such output when they connect.
--
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.
JR
[toc] | [prev] | [next] | [standalone]
| From | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| Date | 2015-03-12 12:53 +0000 |
| Message-ID | <slrnmg3343.30bf.g.kreme@kreme.eternal-september.org> |
| In reply to | #70914 |
Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was all, like: > This isn't what Lewis wants, but I have this code in my shell startup > files (.bashrc) that shows me a list of available screen sessions when I > have one or more already running during login: > # login greeting for screen [Script snipped] That's not bad, but having it execute on login wouldn't work since I use rsync and sftp nearly as much as I use ssh. It wouldn't be bad as a shell script that could be run manually though. > 37134.ttys001.server (Detached) > To reattach, type: screen -r pid.tty.host I use: screen -DRRS server to reattach (or detach and reattach her if the screen is not detached), but I do name all my screens. -- http://2blog.kreme.com 'But you ain't part of it, are you?' said Granny conversationally. 'You try, but you always find yourself watchin' yourself watchin' people, eh? Never quite believin' anything? Thinkin' the wrong thoughts?'
[toc] | [prev] | [next] | [standalone]
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Date | 2015-03-12 12:57 +0000 |
| Message-ID | <cmdgqaFu491U3@mid.individual.net> |
| In reply to | #70926 |
On 2015-03-12, Lewis <g.kreme@gmail.com.dontsendmecopies> wrote: > Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was all, like: >> This isn't what Lewis wants, but I have this code in my shell startup >> files (.bashrc) that shows me a list of available screen sessions when I >> have one or more already running during login: > >> # login greeting for screen > > [Script snipped] > > That's not bad, but having it execute on login wouldn't work since I use > rsync and sftp nearly as much as I use ssh. It only interferes when one or more screen sessions are *detached*. For me, it's a rare enough occasion that doing this at login is not much of an inconvenience. Different strokes. : ) > It wouldn't be bad as a shell script that could be run manually though. I ain't stopping you. : ) >> 37134.ttys001.server (Detached) > >> To reattach, type: screen -r pid.tty.host > > I use: screen -DRRS server to reattach (or detach and reattach her if > the screen is not detached), but I do name all my screens. I'm not a heavy user of screen, and am way too lazy for that. : D -- E-mail sent to this address may be devoured by my ravenous SPAM filter. I often ignore posts from Google. Use a real news client instead. JR
[toc] | [prev] | [next] | [standalone]
| From | Lewis <g.kreme@gmail.com.dontsendmecopies> |
|---|---|
| Date | 2015-03-12 13:29 +0000 |
| Message-ID | <slrnmg356g.30bf.g.kreme@kreme.eternal-september.org> |
| In reply to | #70927 |
Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was all, like: > On 2015-03-12, Lewis <g.kreme@gmail.com.dontsendmecopies> wrote: >> Okay, so one time? In band camp? Jolly Roger <jollyroger@pobox.com> was all, like: >>> This isn't what Lewis wants, but I have this code in my shell startup >>> files (.bashrc) that shows me a list of available screen sessions when I >>> have one or more already running during login: >> >>> # login greeting for screen >> >> [Script snipped] >> >> That's not bad, but having it execute on login wouldn't work since I use >> rsync and sftp nearly as much as I use ssh. > It only interferes when one or more screen sessions are *detached*. For > me, it's a rare enough occasion that doing this at login is not much of > an inconvenience. Different strokes. : ) >> It wouldn't be bad as a shell script that could be run manually though. > I ain't stopping you. : ) >>> 37134.ttys001.server (Detached) >> >>> To reattach, type: screen -r pid.tty.host >> >> I use: screen -DRRS server to reattach (or detach and reattach her if >> the screen is not detached), but I do name all my screens. > I'm not a heavy user of screen, and am way too lazy for that. : D When I login to my machine "Jaka" I name the screen session "jaka" which means I can then login to that same screen from any machine, and can probably do it just using the "sshjaka" alias. I have a half-dozen machines that I access on a daily (or near enough) basis. This is why the double-detach is kind of annoying. When I am logging in to a server from my iphone, I create a session named iPhone since I tend to do different things from the iPhone. -- http://2blog.kreme.com So now you know the words to our song, pretty soon you'll all be singing along, when you're sad, when you're lonely and it all turns out wrong...
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2015-03-11 16:32 -0400 |
| Message-ID | <barmar-EBF0EE.16325811032015@88-209-239-213.giganet.hu> |
| In reply to | #70905 |
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. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [next] | [standalone]
| From | Alan Baker <alangbaker@telus.net> |
|---|---|
| Date | 2015-03-11 13:40 -0700 |
| Message-ID | <mdq98g$9jj$1@news.datemas.de> |
| In reply to | #70910 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Barry Margolin <barmar@alum.mit.edu> |
|---|---|
| Date | 2015-03-11 16:32 -0400 |
| Message-ID | <barmar-6F6B05.16321711032015@88-209-239-213.giganet.hu> |
| In reply to | #70899 |
In article <slrnmg15ld.2870.g.kreme@kreme.eternal-september.org>, Lewis <g.kreme@gmail.com.dontsendmecopies> wrote: > 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. What difference does that make? It's not like the first instance has any state you need to maintain. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.mac.system
csiph-web