MacOS – How to communicate with another computer (on another network) terminal to terminal (OS X )

macosopen sourcesshterminal

I would like to be able to print to the terminal of a computer on a different network (this should work bilaterally). I understand that this should be possible by using the command ntalk, but I have not been able to figure out how.

As I understand it, a way to do that would be to set up a restricted shell for a ssh user which would allow that user to print in the terminal, while not being able execute any other commands, so solutions for that would also be appreciated (as well as any other for that matter).

I'm just looking for a low security risk way to establish a point to point chat similar to IRC and with a minimal requirement to instal or configure additional software if OS X ships with something that can work.

Can ntalk work between another computer and Mac OS X?

Best Answer

It's unclear what you really mean with communicate!

If you want to have a chat-like communication enable ntalk on both hosts:

sudo launchctl load -w com.apple.ntalk

Then enter

talk user@host

to open a chat session.

To enable the chat session on the other side just enter the displayed command e.g.

talk otheruser@otherhost

This might fail if the system versions of the two hosts are different.


To "mirror" a session/attach your Terminal window to another one on a different host use screen:

On host1/user1 enter

screen -S test #test is the sessionname and can be chosen more or less freely

On host2/user2 enter:

ssh -t user1@host1 screen -x test #use the sessionname from above

User1's input will be visible in user2's shell but is unable to execute anything on host2. User2 can execute commands on host1. Both users see all commands entered in both "shells".

Screen is a really mighty tool. Please consult man screen for further informations.