Solved

Send message to all the consoles and show connected users

Posted on 2009-05-15
6
790 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS RDS 3 65
Linux Mint 18 31 73
nagios monitor 3 41
Setting up two Raspberry Pi gateways/routers 3 36
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now