Solved

Send message to all the consoles and show connected users

Posted on 2009-05-15
6
802 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Fine Tune your automatic Updates for Ubuntu / Debian
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.

734 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