2

I would like to understand how could I pull out a list of users that have been added with certain privileges to a Unix system over a certain period of time.

Now, I understand one way to go about would be to check for creation of home directories of the specific users, but I understand users could be created with specific already existing directories as their home directory. In which case we may not be able to pull the exact time of creation of the users to the system.

drs
  • 5,363
  • 9
  • 40
  • 69
tulasi
  • 31
  • 3

1 Answers1

1

You can use awk to filter out new users from /var/log/secure as follows:-

awk '/new\ user/ {gsub(/,|name=/,"",$8); print $1, $2, $3, $8}' /var/log/secure

Note: Debian systems (I believe) use /var/log/auth.log instead.

garethTheRed
  • 33,289
  • 4
  • 92
  • 101