Duplicate user accounts on Linux

2

when I run users it returns 4 duplicates of my user account.

gentoolaptop <user> # users
<user> <user> <user> <user>

I don't remember creating these. How did they get there? Is it safe to delete them?

Gooberpatrol66

Posted 2017-06-25T20:29:44.317

Reputation: 99

Answers

4

First of all, the command really has nothing to do with users you've created. What it actually shows is the users who have logged in:

NAME
       users - print the user names of users currently logged in to the current host

SYNOPSIS
       users [OPTION]... [FILE]

DESCRIPTION
       Output  who is currently logged in according to FILE.  If FILE is not specified,
       use /var/run/utmp.  /var/log/wtmp as FILE is common.

So four entries means four concurrent login sessions by the same person, and it's really the same user account in all cases. Trying to delete one would result in erasing your own existence.

To figure out where they come from, use other tools which examine the aforementioned /var/run/utmp database – namely, who, w, finger, or pinky. They could be:

  • console (text or graphical) logins;
  • network (SSH/Telnet) sessions;
  • terminal emulators (like Xterm or iTerm) also like to create a separate utmp entry for every window currently opened.

(You might want to disable the latter, as every such record is also appended to the wtmp log, which might grow massive after several years.)

user1686

Posted 2017-06-25T20:29:44.317

Reputation: 283 655