To check new user added or deleted in Linux


Scenario: There is a challenge to check how many users are added or deleted in the linux server.

Solution:  #grep useradd /var/log/*

root@orange-hrm:~# grep useradd /var/log/* /var/log/auth.log:Mar 20 11:56:18 orange-hrm sudo: karthick : TTY=pts/0 ; PWD=/home/karthick ; USER=root ; COMMAND=/bin/grep useradd /var/log/alternatives.log /var/log/alternatives.log.1 /var/log/alternatives.log.2.gz /var/log/alternatives.log.3.gz

/var/log/alternatives.log.4.gz /var/log/alternatives.log.5.gz /var/log/apache2 /var/log/apt /var/log/auth.log /var/log

/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /var/log/auth.log.4.gz /var/log/boot /var/log/boot.log

 /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /var/log/cups /var/log/dbconfig-common

Mar 16 14:35:49 orange-hrm useradd[25423]: new user: name=test, UID=1001, GID=1001, home=/home/test, shell=/bin/bash

root@orange-hrm:~#

The similar way for user deletion also (syntax: #grep userdel /var/log/*).

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: