How to Monitor User Activity on Linux with psacct or acct

On any server it’s important to have the most information as possible on what’s going on in real time with tools as pidstat and glances, but it’s also important to collect all the activity done by all the users and processes that are running, to analyze them at a later time or in case of problems of any kind (performance, security, capacity).

psaact as well as acct are both open source application that are used for monitoring user activity on a system. They run in the background keeping track of user activity on a system and the resources consumed by services such as MySQL, Apache, FTP, SSH, et al.

Now with these applications one will be able to track not only user activity, but that of all administrators as well that is performed on a particular server. Consequently, you can make use of this program to know what your users are doing at any given point in time and know what commands they are using as well as be aware of how long it is they are spending on a server.