3

Possible Duplicate:
How to know what user belongs to what ip on debian

Is there a way to see a list of all current logged in user on a Debian server? Sometimes it is very useful to do so, e.g. before updating certain plugins etc.

Any software or built-in features? All users will log in through ssh.

3
  • what do you mean with Debain Apache server? Do you want to know the system users or users which are currently visiting a website?
    – reox
    Feb 15, 2012 at 10:25
  • I'm sorry that was a bit inaccurate. I mean a debian server, and users who are logged into that server. Edited post.
    – cherrun
    Feb 15, 2012 at 10:44
  • Sounds familiar.
    – jscott
    Feb 15, 2012 at 11:06

2 Answers 2

10

use the who command. It will show you the username and the terminal/pseudo terminal that they are using, as well as what time they logged in:

    migs     pts/0        2012-02-15 17:46 (:0)
    migs     pts/1        2012-02-15 17:46 (:0)
    migs     pts/2        2012-02-15 17:48 (:0)

Mine shows three instances of me because I've got two terminal windows open, plus my log-in to the box.

You could also use the last command. This will show the most recently logged in people, as well as currently logged in users.

    migs     pts/2        :0               Wed Feb 15 17:48   still logged in   
    migs     pts/1        :0               Wed Feb 15 17:46   still logged in   
    migs     pts/0        :0               Wed Feb 15 17:46   still logged in
2
  • Nice! Didn't know such commands existed. Does the 'last' command have a limit or will it print out all users who have ever logged in?
    – cherrun
    Feb 15, 2012 at 10:39
  • it will display all log-ins from up to the date the /var/log/wtmp file got rotated. You can check the other wtmp files in /var/log with the -f switch.
    – Migs
    Feb 15, 2012 at 10:45
3

The who command will do the job and show all users logged in.

1
  • Migs answer was a little more accurate. Anyway, thanks!
    – cherrun
    Feb 15, 2012 at 10:38

Not the answer you're looking for? Browse other questions tagged .