How to connect to an already open Terminal session on another Mac

Networksshterminal

I am running Mac OS X 10.7 on a MBP and OS X 10.8 on a Mac Mini. I can connect to the Mini via ssh without any issues.
I am running GNS3 (Network simulation) on the Mini and have configured it so that when I connect to one of my routers via the console, a Terminal window is opened.

On Linux I can connect to a remote terminal sessions if it's using screen or by connecting to the tty.

I would like to connect to the remote Terminal already open on my Mini from my MBP.

Do I need to run the equivalent of screen to be able to do this?

When I do a ps -aux on the Mini I get:

885   0.0  0.4  2622240  18368   ??  S     2:19pm   0:16.27 /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
-psn_0_561289

Is there a way to connect to this terminal from a remote computer when I am connected via ssh?

What does -psn_0_561289 mean?

Can this identifier be used to connect to this terminal?

Best Answer

Screen is the best way to do it. The command is available under both Mac OS X 10.7 and 10.8.

I configured the console sessions in GNS3 to use Terminal and screen with the following command:

/usr/bin/osascript -e 'tell application "terminal" to do script with command "screen telnet %h %p ; exit"'

This can be found in GNS3>Preferences>General>Terminal Settings

Then I list the screen sessions in my remote ssh session with the command:

screen -list

and... finally connect to the required router with:

screen -D -r <name of session obtained with "screen -list" above>