|
|
|
|
||||||
| comp.security.ssh SSH secure remote login and tunneling tools. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
Greetings!
Is there a way to leave a connection open in SSH, something as a 'session' which can be restored later? My scenario is the following: I connect to a remote machine (which has sshd) via SSH, run octave, run a long script (which will probably take about a month to complete), hit Ctrl+Z, type BG. So far so good, my application goes to background. What I would like to do next would be to log out of this ssh connection and, when I return (with the same user), be able to fg %1 and return to the running program. Right now when I try to do this I get a message saying I can't, because there are jobs running on the background. Is there a way to accomplish this? Some configuration in sshd perhaps? I wouldn't like to have to leave two machines turned on whereas one would suffice. Thanking you for your attention, Soleth |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
sgb1010@hotmail.com writes:
> Greetings! > > Is there a way to leave a connection open in SSH, something as a > 'session' which can be restored later? I think you're about to fall in love with Gnu screen. > My scenario is the following: I connect to a remote machine (which has > sshd) via SSH, run octave, run a long script (which will probably take > about a month to complete), hit Ctrl+Z, type BG. So far so good, my > application goes to background. > > What I would like to do next would be to log out of this ssh connection > and, when I return (with the same user), be able to fg %1 and return to > the running program. Right now when I try to do this I get a message > saying I can't, because there are jobs running on the background. > > Is there a way to accomplish this? Some configuration in sshd perhaps? > I wouldn't like to have to leave two machines turned on whereas one > would suffice. ssh blah@remotehost remotehost$ screen [hit enter after swcreen's introductory comments] remotehostinscreen$ . .bash_profile (if ya need to, screen doesn't always fork as a login shell, so you may need to source this) remotehostinscreen$ myfunprocess& remotehostinscreen$ [Ctrl-a d] [detached] remotehost$ exit Days later, from some completely different machine, reconnect to remotehost via any method. remotehost$ screen -r remotehostinscreen$ you'll be right back where you were. Think of screen as VNC for tty's. -r reconnects you. Ctrl-a followed by d disconnects you. Or hell ust kill the terminal. Screen is still there. Enjoy! Screen rocks. -- Todd H. http://www.toddh.net/ |
|
|
|
#5 (permalink) |
|
Messages: n/a
Hébergeur: |
On 13 Sep 2006 21:43:13 -0500, Todd H. <comp@toddh.net> wrote:
> sgb1010@hotmail.com writes: > >> Greetings! >> >> Is there a way to leave a connection open in SSH, something as a >> 'session' which can be restored later? > > I think you're about to fall in love with Gnu screen. I second the recomendation, I have used it for years and love it. i >> My scenario is the following: I connect to a remote machine (which has >> sshd) via SSH, run octave, run a long script (which will probably take >> about a month to complete), hit Ctrl+Z, type BG. So far so good, my >> application goes to background. >> >> What I would like to do next would be to log out of this ssh connection >> and, when I return (with the same user), be able to fg %1 and return to >> the running program. Right now when I try to do this I get a message >> saying I can't, because there are jobs running on the background. >> >> Is there a way to accomplish this? Some configuration in sshd perhaps? >> I wouldn't like to have to leave two machines turned on whereas one >> would suffice. > > ssh blah@remotehost > remotehost$ screen > > [hit enter after swcreen's introductory comments] > > remotehostinscreen$ . .bash_profile (if ya need to, screen doesn't always > fork as a login shell, so you may need to source this) > > remotehostinscreen$ myfunprocess& > remotehostinscreen$ [Ctrl-a d] > [detached] > > remotehost$ exit > > > > Days later, from some completely different machine, reconnect to > remotehost via any method. > > remotehost$ screen -r > remotehostinscreen$ > > you'll be right back where you were. > > Think of screen as VNC for tty's. -r reconnects you. Ctrl-a > followed by d disconnects you. Or hell ust kill the terminal. > Screen is still there. > > > Enjoy! Screen rocks. > |
|
|
|
#6 (permalink) |
|
Messages: n/a
Hébergeur: |
"Gustavo L. Fabro" <glfabro@gmail.com> writes:
> > Enjoy! Screen rocks. > > Beautiful!!! Exactly what I wanted!!!!!! > > Thank you very much! Works as a charm! You guessed right, I'm indeed in > love with this new tool! ;-) One more switch to know... If when you do screen -r to reattach it complains that there aren't any unattached screens (which will happen if you get disconnected (e.g. network blip) and then try reconnect relatively quickly), in that case: remotehost$ screen -r -d will force the detaching of your prior screen session and get you back where you wanna be. If you're an emacs user and want to remap the control-a to something else, drop something like this in .screenrc escape ^Tt (I map mine to Ctrl-t since Ctrl-a is beginning of line in emacs and I use it all the time. ) And now, I get to introduce you to new virtual screens. :-) From inside of screen. Try Ctrl-a c (c for create) This creates a new shell inside of screen. To toggle back to the other one, do Ctrl-a n (n for next). Repeat as desired. Have fun! I <3 screen. -- Todd H. http://www.toddh.net/ |
|
|
|
#7 (permalink) |
|
Messages: n/a
Hébergeur: |
On 13 Sep 2006 22:36:01 -0500, Todd H. <comp@toddh.net> wrote:
> "Gustavo L. Fabro" <glfabro@gmail.com> writes: > >> > Enjoy! Screen rocks. >> >> Beautiful!!! Exactly what I wanted!!!!!! >> >> Thank you very much! Works as a charm! You guessed right, I'm indeed in >> love with this new tool! ;-) > > One more switch to know... > > If when you do screen -r to reattach it complains that there aren't > any unattached screens (which will happen if you get disconnected > (e.g. network blip) and then try reconnect relatively quickly), in > that case: > > remotehost$ screen -r -d > > will force the detaching of your prior screen session and get you back > where you wanna be. even better is to type screen -d -R, that would reattach the screen if it exists, or create a new one. > If you're an emacs user and want to remap the control-a to something > else, drop something like this in .screenrc > > escape ^Tt > > (I map mine to Ctrl-t since Ctrl-a is beginning of line in emacs and > I use it all the time. ) Just get used to it. ![]() i |
|
|
|
#8 (permalink) |
|
Messages: n/a
Hébergeur: |
Ignoramus7715 <ignoramus7715@NOSPAM.7715.invalid> writes:
> even better is to type screen -d -R, that would reattach the screen if > it exists, or create a new one. Ooh... I like it! > > If you're an emacs user and want to remap the control-a to something > > else, drop something like this in .screenrc > > > > escape ^Tt > > > > (I map mine to Ctrl-t since Ctrl-a is beginning of line in emacs and > > I use it all the time. ) > > Just get used to it. ![]() Too many years... I couldn't! :-) -- Todd H. http://www.toddh.net/ |
|
![]() |
| Outils de la discussion | |
|
|