Pages

Saturday, June 24, 2017

How to Monitor User Activity with psacct or acct Tools

psacct or acct both are open source application for monitoring users activities on the system. These applications runs in the background and keeps track of each users activity on your system as well as what resources are being consumed.
I personally used this program in our company, we have development team where our developers continuously work on servers. So, this is one of best program to keep a eye on them. This program provides an excellent way to monitor what users are doing, what commands are they firing, how much resources are being consumed by them, how long users are active on the system. Another great feature of this program is it gives total resources consumed by services like Apache, MySQL, FTP,SSH etc.

Linux User Activity Monitoring
Linux User Activity Monitoring
I think this is one of the great and must needed application for every Linux/Unix System Administrators, who wanted to keep a track of user activities on their servers/systems.
The psacct or acct package provides several features for monitoring process activities.
  1. ac command prints the statistics of user logins/logouts (connect time) in hours.
  2. lastcomm command prints the information of previously executed commands of user.
  3. accton commands is used to turn on/off process for accounting.
  4. sa command summarizes information of previously executed commands.
  5. last and lastb commands show listing of last logged in users.

Installing psacct or acct Packages

psacct or acct both are similar packages and there is not much difference between them, but the psacct package only available for rpm based distributions such as RHELCentOS and Fedora, whereas acct package available for distributions like UbuntuDebian and Linux Mint.
To install psacct package under rpm based distributions issue the following yum command.
# yum install psacct
To install acct package using apt-get command under Ubuntu / Debian / Linux Mint.
$ sudo apt-get install acct
OR
# apt-get install acct
Starting psacct or acct service
By default psacct service is in disabled mode and you need to start it manually under RHEL/CentOS/Fedora systems. Use the following command to check the status of service.
# /etc/init.d/psacct status
Process accounting is disabled.
You see the status showing as disabled, so let’s start it manually using the following both commands. These two commands will create a /var/account/pacct file and start services.
# chkconfig psacct on
# /etc/init.d/psacct start
Starting process accounting:                               [  OK  ]
After starting service, check the status again, you will get status as enabled as shown below.
# /etc/init.d/psacct status
Process accounting is enabled.
Under UbuntuDebian and Mint service is started automatically, you don’t need to start it again.

      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
                                                    ► Read more: http://adf.ly/1n7SIB
      ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

No comments:

Post a Comment