I am on Mac OS X, and ideally I could do this without installing other software, using something built in.
Put this in your .bashrc file:
function talk { echo "$USER: $@" >> talkfile; }
then run: tail -f talkfile &
The & puts tail into the background so it continues running, and "talkfile" needs to be a file that both of you have write access to.You can both communicate simply by using the talk function like any other bash command:
talk whatever you want and it'll be written to talkfile
This works on Linux, not sure about Mac.It's nice because it records what you say, so there's no need for the other person to be logged in to get your message, and you get a printout of the last few lines of conversation when you "login" (run the tail -f command). There's nothing extra to install either.
(edit, apparently say is already installed on OS X, so I renamed the function "talk")
https://wiki.archlinux.org/index.php/Talkd_and_the_talk_comm...
Make sure to "mesg y" before :-)
We have a 'jump' server, used to ssh into remote boxes, a truly public space with numerous users, such as myself, logged in poking around looking for the right hostnames etc. Having just learned of the wall command, I alt-tabbed to a session and thinking it fun to give a whirl. My message?
"Whats up playas"
A brief reprieve. But ah the word!
"Yo."
So came the flurry. A new message. And another. And another. Messages scratched across the server wall as though all the company had congregated outside this massive sleek black edifice where our words so glowed. I'm sure even some HR slavers or sales kin made the trek through the Terminal Wastes to bear witness to this spectacle. It was our digital Wailing wall except our shrieks were laughter. We were posting ASCII art by the time a sysadmin stepped in and put a stop to our revelry. Anymore posting would result in bans, temporary of course, but exile nonetheless.
Silence.
Then the CEO:
"Sup."
Just to note, on the Mac there's already a /usr/bin/say, which invokes the text-to-speech. So if you don't create your function, SSHing to the friend's Mac and typing 'say whatever you want' will have an interesting but probably not desired effect :) I'll admit to having used this on a friend's machine once or twice for amusement.
(And invoking 'say' invokes the TTS even if you SSH in as a user other than the one logged in to the main GUI. I'm pretty sure this wasn't always the case; not sure when it changed.)
Been this way since at least 2008 - I remember doing this back in school when bored in class.
echo hello | festival -b --tts man say function talk { while read line ; do echo "$USER [`date +%T`]: $line" >> $talkfile ; done } # you type:
$ screen -S session1 vim file.txt
# and they can type (as the same user)
$ screen -x session1
# or with tmux, you type:
$ tmux new -s session1 vim file.txt
# they type (as the same user)
$ tmux a -t session1
You can try it out with two terminals on your own.[0] http://tmate.io/
The most difficult part of using this for me seems to be trusting tmate--not that tmate is inherently untrustworthy, but IMO untrustworthy by default is a good policy.
Although, I agree with the "untrusted by default" sentiment of the fellow commenter below :/
EDIT: Oh, it comes with an open-source server? This is brilliant.
There's something to be said of the old-school wonder of fingering random machines on the internet (say, from one's email bang path) for logged-in users then initiating talk sessions.
Maybe even spin up VMs on demand based on new hostname (if not seen before). First to claim = own. Some rate limiting function.
Shell accounts largely went away due to ease of use, but also local user exploits and abuse, but enh. If you virtualized the network (so you could reroute through a new IP on abuse, or let users own the IP) and restricted functionality it wouldn't be as bad.
No practical purpose, just fun.
You run:
nc -l 5000
They run: ssh [yourhost] nc localhost 5000
The only issue I see is that you apparently can't get netcat to only listen on localhost so others could join in in theory.nc -l 127.0.0.1 5000
(I guess you could run Zephyr with somewhat less than that, and maybe it has improved in the past 15y for small deployments, but, when I tried in 2001 it was insane)
#!/bin/bash
# Simple chat system for when Skype is fucked.
nick=${1?Usage: $0 nickname (e.g. $0 biturd)}
chan=/tmp/yapchan
echo "^D to exit chat." >&2
tail -F "$chan" & tailpid=$!
trap 'kill "$tailpid"' 0
while IFS='' read -er line; do echo "<$nick> $line"; done >> "$chan"
If you're running this with multiple accounts, you may need to chmod a+w /tmp/yapchan, and if you're using MacOS on the server, you may need to use a different filename since MacOS has a per-user private /tmp.just write <systemusername> <tty|ptsname> enter message and quit with ctrl-d
from man page:
DESCRIPTION
The write utility allows you to communicate with other users, by copying lines from your terminal to theirs.
When you run the write command, the user you are writing to gets a message of the form:
Message from yourname@yourhost on yourtty at hh:mm ...
Any further lines you enter will be copied to the specified user's terminal. If the other user wants to reply, they must run write as well.
When you are done, type an end-of-file or interrupt character. The other user will see the message ‘EOF’ indicating that the conversation is over.
You can prevent people (other than the super-user) from writing to you with the mesg(1) command.
If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the terminal name as the second operand to the write command. Alter‐
natively, you can let write select one of the terminals - it will pick the one with the shortest idle time. This is so that if the user is logged in at work and also dialed up from home, the message
will go to the right place.
The traditional protocol for writing to someone is that the string ‘-o’, either at the end of a line or on a line by itself, means that it is the other person's turn to talk. The string ‘oo’ means
that the person believes the conversation to be over.There's also OpenSSL s_client/s_server for an encrypted connection, although you need to setup some certificates first.
You can use "https://telegram.org" telegram messsenger.
It works flawlessly from the cli.
Yes, you cannot use it if you don't want your chats to pass through a third party server. But maybe you can try out the "secret chat" feature with auto destroy feature.
The traditional options have already been listed by others here. I just wanted to tell something which is easy to setup and also reliable.
We login to same server to do :
#create a screen
screen -S chat
#Both of us will join the screen:
screen -x chat
#Now we can see each other typing. Make typing easier do:
write pts/<id> username
#Make sure there is another login and use that pts <id> above.
After we typed our lines, to indicate I'm waiting for his response. I'll adding 2 or 3 newlines.
That's it ! :)Simple chat over ssh.
Once connected to someone's host, use the Talk program (https://en.wikipedia.org/wiki/Talk_%28software%29), or the Write program (https://en.wikipedia.org/wiki/Write_%28Unix%29), or use Netcat (http://hak5.org/episodes/haktip-82) to open a two-way dialogue between terminals. Netcat is the simplest of them all because it just opens a two-way tcp session, and technically only one of you needs netcat while the other just needs a telnet client or equivalent.
But when you mention "wall(1)" it makes it sound like you want to connect to some internet accessible UNIX host via ssh and chat to others who are also connected to that host.
Option 2 would be less complex.
Depending on what software is installed on the host you connect to, there are many possibilities. Back in the old days, talk(1) could be used for split screen chats. Today, tmux(1) would be my choice. Anything that uses UNIX domain sockets could work.
Proof of concept:
Does Darwin have logger(1), syslogd(8) and /etc/syslog.conf(5)?
Decide where to log the messages, e.g., /var/log/messages
Edit /etc/syslog.conf
Start syslogd
logger "your message"
less /var/log/messages
less -F /var/log/messages
tail -f /var/log/messages
Messages have date, time, priority (if any) and hostname.
You said "something basic"; this is about as basic as it gets.
http://ss64.com/bash/write.html
You would need to run two instances of write : you would write to your friend and your friend would write to you.
Just press Enter twice when you are done with your turn (I.e. "over" as in, transmission over)
1. Install that on a machine.
2. Both SSH to the that machine machine.
3. Type: `hey <username>`, press enter.
4. Enter your (optionally multiline) message to your friend.
5. CTRL+D (on windows, at least) to send the message.
6. ????
7. Profit.PS: Huge kudos for the question, btw. This is the kind of stuff that really improves your ability to use your system well.
screen -S chat
The other user types
screen -xr chat
Log into a box, use 'who' to see which terminal they're using, and use 'write' to send a message there.
Or be lazy and just use 'wall' (write all) like I do.
ssh one box to another, then:
who -uT // show who is connected to a machine and will they recieve message sent with write or wall command
write // sends a message to another user (tty). dont do this as it can confuse the other user by inserting the message in the middle of his current output.
wall //send a msg to all of the logged in users
talk & talkd // client and server. (old school rulz!)
>usage: write user [tty]
kibitz - allow two people to interact with one shell
apt-get install nmap
ncat --chat -lp 1234