Solved

Send message to all the consoles and show connected users

Posted on 2009-05-15
6
796 Views
Last Modified: 2013-12-16
Hello,
I would like to know how many ssh sessions are connected to my Linux and if it is possible also the username used and the ip address.

I would like also to know what is the command that I can run by console, so that this message will be shown to all the other ssh remote consoles.

Thanks
0
Comment
Question by:ping_it
  • 3
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
thetmanvn earned 400 total points
ID: 24393343
1.
root@test:~# who
root     pts/0        2009-05-15 11:35 (192.168.x.x)
root     pts/1        2009-05-15 15:47 (192.168.x.y)

2.

root@test:~# wall
hello
<------------ Press Ctrl+D
Broadcast Message from root@test
        (/dev/pts/1) at 15:51 ...

hello
0
 
LVL 8

Expert Comment

by:thetmanvn
ID: 24393354
More information, you could see who and wall manual.

http://linux.about.com/library/cmd/blcmdl1_who.htm
http://linux.about.com/library/cmd/blcmdl1_wall.htm

Hope this help.
0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 100 total points
ID: 24393416
Hi,

This command will give you the users connected and ssh connections:

lsof -i | grep ^sshd | grep EST | awk '{ print $3, $8 }'

You can broadcast it to all connected usrs with wall as thetmanv suggested like that:

lsof -i | grep ^sshd | grep EST | awk '{ print $3, $8 }' | wall

Cheers,
K.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24393579
BTW who will show all interactive logins including console and telnet and SSH.

Cheers,
K.
0
 
LVL 5

Author Comment

by:ping_it
ID: 24393721
thanks
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24393753
You're welcome :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question