Results 1 to 10 of 10

Thread: Connect to a tty-session

  1. #1
    Join Date
    May 2008
    Location
    US
    Beans
    27
    Distro
    Ubuntu

    Connect to a tty-session

    Hi,

    Does anyone know of a way to connect to a tty-session (e.g. ctrl+alt+f2) after SSH'ing into a server -- assuming that a screen session hasn't already been initiated?

    I would like to access a session I have open on a remote server on tty2 (ctrl+alt+f2), but I didn't start a "screen" command on tty2 prior to leaving the server.

    Is there any hope? I've tried prying around on Google, and the only results I've been able to find are websites that suggest using "screen" or those that you have to subscribe to a pay-service to access their answers.

    Thank you!

  2. #2
    Join Date
    May 2008
    Location
    US
    Beans
    27
    Distro
    Ubuntu

    Re: Connect to a tty-session

    PS -- Reviewing my thread, I might not have put this thread in the right category (and if so, I apologize), but it seemed a "networking" problem (sort of) at the time.

  3. #3
    Join Date
    May 2008
    Location
    US
    Beans
    27
    Distro
    Ubuntu

    Re: Connect to a tty-session

    Bump

  4. #4
    Join Date
    Dec 2006
    Beans
    1,133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Connect to a tty-session

    I'm not understanding; Are you saying that you disconnected from an SSH session, without running screen, but the session is still somehow running? In my experience once you disconnect from the server, the tty is shut down/freed and user processes killed (unless nohupped) just as if you had logged off. and no longer accessible, without using screen (or something like it)
    There are no dumb questions, just dumb answers.

  5. #5
    Join Date
    May 2008
    Location
    US
    Beans
    27
    Distro
    Ubuntu

    Re: Connect to a tty-session

    Quote Originally Posted by lswb View Post
    I'm not understanding; Are you saying that you disconnected from an SSH session, without running screen, but the session is still somehow running? In my experience once you disconnect from the server, the tty is shut down/freed and user processes killed (unless nohupped) just as if you had logged off. and no longer accessible, without using screen (or something like it)
    Ah, I apologize for not being clearer.

    What I am referring to is this:
    On the server, I did Ctrl+Alt+F2, and this brings up "tty2", a non-graphical basic terminal for the system (the same happens with any F1-F6, each bringing up tty1-6, respectively). I log in to tty2, run a command, then walk away from the computer (with everything still logged in, etc). How (if possible) can I open this session and continue it via SSH? Because the session is still technically running on the server, on "Ctrl+Alt+F2", yet I am several miles away from my server now.

  6. #6
    Join Date
    Dec 2006
    Beans
    1,133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Connect to a tty-session

    I can't say it is impossible but without running screen first or making some other provision, I know of no way to take over a running tty or pty. What you could do is ssh in to a new session and kill the old one and any processes you started from it.
    There are no dumb questions, just dumb answers.

  7. #7
    Join Date
    May 2008
    Location
    US
    Beans
    27
    Distro
    Ubuntu

    Re: Connect to a tty-session

    Quote Originally Posted by lswb View Post
    I can't say it is impossible but without running screen first or making some other provision, I know of no way to take over a running tty or pty. What you could do is ssh in to a new session and kill the old one and any processes you started from it.
    Ah, okay, I guess this could work. I'm not desperate to take total control over the session, but the idea struck my mind the other day, and I kept wondering if it was possible.

    Thank you for your suggestion!

  8. #8
    Join Date
    Sep 2006
    Beans
    6

    Re: Connect to a tty-session

    Here's a solution if your still looking for one:
    http://www.ryanwalsh.ca/blog/?p=7

    Some of us have run across situations where we want to be able to keep user-mode programs running in a Linux TTY session, but still want to be able to manage them remotely through SSH or other means.

    One solution is the ‘linuxvnc’ utility, which can grab a TTY session and display it for use in a VNC window. I will be covering this utility, as tested on Ubuntu 7.04 Feisty (although it should work for virtually any distro).

    For starters, let’s grab linuxvnc from the repositories with apt:

    Code:
     sudo apt-get install linuxvnc
    Once that is done, fire it up: (root access is required to grab TTYs)

    Code:
     sudo linuxvnc X
    Where ‘X’ is the TTY # you want to grab. linuxvnc should indicate that it’s listening on port 5900.

    You can now connect with any VNC client, such as RealVNC, KRDC, or whatever. One thing I’ve noted is that KRDC has trouble with linuxvnc sessions if it attempts to use ‘Tight’ VNC encoding. I would recommend using zlib instead.

    Of course if you’re using VNC over the Internet, I strongly recommend tunneling it through SSH. That, however, is a tip for another day.

  9. #9
    Join Date
    May 2010
    Location
    india
    Beans
    21
    Distro
    Ubuntu Development Release

    Re: Connect to a tty-session

    give me some time to answer
    if you like my posts, please follow me for some cheesy, witty and useful updates..
    ttp://twitter.com/geeky_geet

  10. #10
    Join Date
    Jul 2011
    Beans
    2

    Re: Connect to a tty-session

    Thanks davepc. This one works fine.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •