Monitor user activity with acct command

All of us who manage servers know that we must have control or at least frequently supervise all activity that other users do on the server, there are several ways to keep track of users, today I will show you an application that will help us with this: act

Note, all the following commands will be executed as root, hence the lack of sudo

To install it you know, install the acct package, in distros like Debian or derivatives:

apt-get install acct

Once installed, we are going to make sure the daemon is active:

service acct start

In distros that use systemd it would be:

systemctl start acct

Well, it is up and running. and now that? 🙂

We have many options now, or rather, many new commands. For example:

Command ac

The ac command gives us connection time information, if we execute it without parameters it will tell us how long users were logged into the system.

If we execute it with the -d parameter it will divide it into days, that is:

ac-parameter-d

While the parameter -p It divides it into users:

ac-parameter-p

And if you want to mix the results, we can see the connection time of each user divided by days with the command: ac -d the_user

ac-parameter-pd

Command sa

This command shows us as such other commands executed by other users, for example:

sa -u

This will show us the last commands executed by any user on the system:

sa-parameter-u

Lastcomm command

This command shows us the last commands executed by each user, by default it will show us the last commands of all users, but obviously we can tell it to show us only the commands of a certain user, for example:

lastcomm root

lastcomm-user-root

And we can also search instead of by user, search by command:

lastcomm COMANDO

That is:

lastcomm touch

lastcomm-command

And here I have finished talking about the commands that we will have available if we install the acct package

As I said at the beginning, there are several ways to know what a user does or stops doing in the system, we can also always check the .bash_history of his home but, as some should know, the content of the history can be deleted so, method that I present here can be very effective compared to others 😉

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Jesus Israel Perales Martinez said

    This is very good, I'll try it

  2.   msx said

    Uff, chiché hottie, I didn't know him, big KZ!

    1.    msx said

      ERRATA: chiche 😉

      You may be interested in this other tool similar to acct but oriented to the network use of each logged in user: http://www.pmacct.net/

    2.    KZKG ^ Gaara said

      Thanks, I try to put interesting things ... today I have prepared another very good post 😀

  3.   clow_eriol said

    Very interesting 🙂

  4.   Pablo said

    Ahhh ... the terminal ... there is nothing to give it ...

    1.    taregon said

      It only remains to learn the commands and use them.

      1.    eliotime3000 said

        That's true.

  5.   eliotime3000 said

    The good thing about GNU / Linux is that you don't depend on keyloggers or anything like that. That's what the terminal is for (although it is itself a double-edged tool).

  6.   auroszx said

    I'm going to test it 🙂 For the Archers, the package is in AUR as "acct".