# SSH: keep login active/Login to a previously started session

## WarMachine

What I'm looking to do is (over ssh) keep my login active even if I close off the connection from the client comptuer (it's windows, so this will most likely be used for reboots).  I'd like to log back in and have my processes stilll running and windows, whatnot where they were when I left them before.  I hope I'm not asking for a miracle, but anything is possible with *nix.

If it helps I run sshd from openssh's package on the host machine, and ssh.com's free trial client on my client machine.

----------

## msteller

emerge screen

Screen is an application that allows you to create virtual screens in a single terminal session.  You can disconnect and re-attach to the previous sreen session later from any new terminal session.

Notes:

screen  (starts screen)

  ctrl-a c         create new virtual screen

  ctrl-a ctrl-a   swap to previous screen

  ctrl-a n         swap to next screen

  ctrl-a esc     arrow up or down thru virtual buffer.  esc to exit scrolling.

screen -r   (re-attach to disconnected session)

screen -rd (re-attach to session and disconnect connected terminal)

                 useful if you left your session connected on a remote pc

----------

## rizzo

Yes screen is the answer.  It has saved me because when I'm at home and my VPN connection disconnects I can just log back in and view my oracle queries in progress.

Just another vote for screen.

----------

## WarMachine

screen rules, thanks guys   :Mr. Green: 

----------

## Riveri

can i use screen somehow to X programs... 

i just keep getting this when i put screen -r

konqueror: Fatal IO error: client killed

ICE default IO error handler doing an exit(), pid = 7323, errno = 32

in that case i was trying to open session where i had konqueror open...

or is there some better prog for this ?

----------

## aleks04

VNC would be my choice for X stuff. For that, instead of running stuff in an X server, you run it in a VNC server, to which you can connect any time and even share connection.  Though ofcourse it's not as fast as an X server, it still works pretty well.

One of the versions of VNC out there is TightVNC: http://www.tightvnc.org/

or `emerge tightvnc` .

----------

## Riveri

Thanks!

It works just like i wanted it to work...

----------

## wers

Good day. I wonder what happens when i occasionally close the ssh session which was without screen support? It has 107 packages in recompiling. Is gentoo still working on this task or not? I've already read the putty's faq but couldn't find the answer...

----------

## Bio

 *wers wrote:*   

> Good day. I wonder what happens when i occasionally close the ssh session which was without screen support? It has 107 packages in recompiling. Is gentoo still working on this task or not? I've already read the putty's faq but couldn't find the answer...

 

No your task will end when putty ends.

To avoid that you can launch a task with the nohup (no hang up) tag. iie nohup emerge mypackage

This will ensure your task keeps running even if your ssh session ends abruptly.

The output of the command is logged to a nohup.out file so you can monitor the progress

----------

