Who’s SSHed Into My Server?

Posted on by Patrick Hawkins
Reading Time: 2 minutes

So, you know how to ssh into your server. But how do you know if anyone else is shelled into your VPS server or Dedicated server?

If more than one person is shelled into a server, and all are trying to fix a problem, it is possible that they could step on each other’s toes. How horrible would it be if two people intending to fix the issue ended up making it worse? It would be grand if the shell provides a simple yet strong command that displayed all the users who are shelled in.

As it turns out, Linux does have such a command:

w

That’s right: simply typing the small and mighty w into your shell and hitting enter will give you a wealth of information on who is doing what on the server at a given time.

root@host [~]# w
18:19:42 up 350 days, 14:14,  1 user,  load average: 0.15, 0.05, 0.01
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     ttyp0    10.30.6.167      18:19   749days  0.01s  0.00s w

A lot of information is packed into a few lines; let’s unpack it.

  • The first line shows what you would see if you ran the uptime command. While uptime is a fast way to find out what the load on a server is, w is even faster.
  • The next line lists the information that you’ll see below:
  • USER lists the linux user that is logged in
  • TTY shows the terminal type that the user is using. It is usually a ttyp#, but could also be a screen.
  • FROM is the most useful; it shows either the IP address or the hostname of the user that’s logged in. If you see IPs that are not yours, that most likely means that a support technician is logged in to your server and working on an issue.
  • LOGIN@, IDLE, JCPU, and PCPU may not be accurate if you are on a virtual environment. The above example is on a VPS, so it is not accurate.
  • WHAT shows the command that that user is currently running. In the above example, I am running w.
If You See Us In Your Server, Please Call Us

When your server is being worked on by one of our Heroic Support Technicians, communication with us can be key. Please call our support line to find out just what is going on, or to let us know what you intend to do. Keeping an open line of communication will help both you and us solve issues faster, and prevent future problems.

Avatar for Patrick Hawkins

About the Author: Patrick Hawkins

Patrick Hawkins is a former Test Engineer and Managed WordPress admin with Liquid Web

Latest Articles

How to Use React Spring

Read Article

Accessing Man Pages on Ubuntu 16.04 LTS

Read Article

TLS vs SSL: A Comparison

Read Article

Premium Business Email Pricing FAQ

Read Article

Microsoft Exchange Server Security Update

Read Article