Skip to content
  • Home
  • Services
    • Combo Plans
      • Shared Support
      • Semi Dedicated Support
      • Dedicated Support
    • Control Panel Support
      • DirectAdmin Support
      • cPanel Support
      • Plesk Support
    • Server Setup & Support
  • Products
    • Managed Migration
    • Nginx Support
    • Varnish Support
    • Shield
  • Careers
    • Internship Programme
  • KnowledgeBase
  • Contact Us
  • Blog
  • About Us

WHM-cPanel Control Panel

4
  • How to log in to cPanel?
  • How to find outdated services in cPanel
  • Exclude services from the outdated services script’s check in cPanel
  • catch-all accounts, and how to add that in cPanel

Email

3
  • How to install mail function on a Centos server.
  • SPF, DKIM, and DMARC records explained
  • How to configure an Email account manually on the Thunderbird client

SSL certificates

3
  • How to install SSL on nginx with Let’s Encrypt
  • SSL installation and renewal on an Nginx server
  • Installation of SSL in Haproxy and HTTP to HTTPS Redirection

Webservers

1
  • Enable GZIP compression in Nginx

Security

1
  • Disabling mail alerts from LFD

News

46
  • White House report on Open-source AI models
  • Linux Kernel 6.9 – End of Life
  • Verify if SystemD or not on Linux
  • SLUBStick: A Groundbreaking Kernel Exploitation Technique
  • Top 5 Linux Distros for Every User Level
  • Alpaca: The Open-Source AI Model for Linux Enthusiasts
  • Zero-Day Threat: The Risks of the IP Address Exploit
  • Intel Engineer Boosts Linux Kernel Boot Time by 0.035 Seconds
  • Canonical’s New Aggressive Kernel Policy: Ubuntu Releases
  • KDE Frameworks 6.5 Released: What’s New?
  • Ubuntu 24.10 to Feature the Latest Linux Kernel
  • Linux 6.11-rc3 Released: Performance Boosts and Key Fixes
  • The Open Model Initiative Joins the Linux Foundation
  • New Study Debunks Fears of AI Threats
  • AI-Powered Screenshot Search for Pixel 9 Devices
  • Fastfetch: A High-Performance Alternative to Neofetch
  • Containers: Efficient OS-Level Virtualization & Top Tools
  • Tails 6.6-Enhanced Security, Anonymity,Decentralized Features
  • Kubernetes 1.31 “Elli” Release: New Features and Updates
  • Unleashing the Power of Arch Linux with Archinstall 2.8.2
  • Deepin 23 Released with Atomic Updates and Broad CPU Support
  • Secure Your Linux Systems with Expert Cybersecurity
  • NGINX Fixes Buffer Overread Vulnerability (CVE-2024-7347)
  • Linux Kernel Flaw Lets Attackers Bypass CPU and Write to Memory
  • 0.0.0.0 Day Vulnerability:18-Year-Old Browser Flaw
  • CachyOS August 2024: Open NVIDIA Modules & COSMIC Desktop
  • Windows Update Breaks Linux Boot on Dual-Boot Systems
  • EasyOS 6.2 Released: Lightweight Linux Distro-New Features
  • Upstreaming Linux Kernel Support for Raspberry Pi 5
  • Canonical Pauses Ubuntu Kernel Updates Until October 2024
  • 9 Years of LVFS: Transforming Linux Firmware Updates
  • Record Bounty Awarded for LiteSpeed Cache Vulnerability
  • Red Hat OpenShift Lightspeed: AI Assistant for OpenShift
  • Linux 6.12 Introduces QR Code in DRM Panic Handler
  • Rust for Linux Maintainer Resigns Amid ‘Nontechnical Nonsense’
  • Ubuntu 24.10 to Feature Latest Linux 6.11 Kernel
  • LinkedIn Migrates from CentOS to Azure Linux
  • Linux 6.11-rc5 Released with Streamlined Bcachefs Fixes
  • AMD Preferred Core Fix Arrives Before Linux 6.11-rc6
  • Debian 12.7 Released: 55 Security Updates, 51 Bug Fixes
  • 4MLinux 46 Released: New Apps, LAMP Server Included
  • Cicada3301 Ransomware Targets VMware ESXi Systems
  • Advanced Linux Persistence Techniques: Elastic Security’s Insights
  • Sedexp Malware Evades Detection for Two Years on Linux
  • Minimal Linux Runs on Raspberry Pi’s RP2350 Microcontroller
  • Manage Linux User Activity with Acct/Psacct

Operating System

1
  • CentOS 7 End-of-Life: What You Need to Know and How to Migrate
  • Home
  • KnowledgeBase
  • News
  • Manage Linux User Activity with Acct/Psacct
View Categories

Manage Linux User Activity with Acct/Psacct

4 min read

The acct or psacct tools are vital for system administrators to track user activity and resource usage on Linux systems. Though they go by different names—acct for Debian/Ubuntu and psacct for RedHat/Fedora—they function identically.

These tools install several programs that work together to monitor users. Here’s a breakdown of the key commands:

  • ac: Shows how long users have been connected.
  • lastcomm: Lists commands executed by users.
  • accton: Enables or disables process accounting.
  • sa: Summarizes accounting information.

Installing acct/psacct #

Install the appropriate package for your Linux distribution:

  • Debian/Ubuntu: $ sudo apt install acct
  • RedHat/Fedora: $ sudo dnf install psacct
  • Arch Linux: $ sudo pacman -S acct
  • OpenSUSE: $ sudo zypper install acct
  • Alpine Linux: $ sudo apk add psacct

After installation, ensure the service is running:

 

Psacct 1

If inactive, start and enable the service:

Psacct 2

#

Using acct/psacct #

  1. Check User Connect Time:
    • Command: $ ac
    • Shows the total time users have been connected.
  2. Check User Connect Time (All Users):
    • Command: $ ac -p
    • Displays login time for each user.
  3. Check Day-Wise Connect Time:
    • Command: $ ac -dp
    • Shows login time per day, with usernames.
  4. List Commands Executed by Users:
    • Command: $ sudo sa
    • Lists all commands run by users.
  5. List Resources Used by Users:
    • Command: $ sudo sa -m
    • Shows recent resource usage per user.
  6. List Last Executed Commands:
    • Command: $ sudo lastcomm
    • Displays records of the last commands executed by users.

These tools are indispensable for monitoring user activity and managing system resources effectively.

The acct and psacct tools are invaluable for Linux system administrators who need to monitor user activity and resource usage. These tools offer detailed insights into what users are doing on the system, which can be crucial for auditing, performance optimization, and security purposes.

Why Use Acct or Psacct? #

System administrators often need to track user behavior for several reasons, such as ensuring that no unauthorized activities are occurring, diagnosing system performance issues, or simply understanding how resources are being used. The acct and psacct tools are designed to make this process easier by automatically logging user commands, login times, and resource consumption.

For instance, if you’re managing a multi-user server, it’s essential to know how long each user is connected, what commands they are running, and how much CPU time they are consuming. This information can help in identifying users who may be overutilizing resources or those who may be attempting unauthorized actions.

Key Commands and Their Usage #

Here’s a deeper look into some of the key commands provided by acct or psacct:

  1. Tracking User Connection Time with ac:
    • Running the ac command with different options allows you to monitor how long users have been connected to the system. This is particularly useful for billing purposes in a shared environment or for identifying users who might be occupying system resources for extended periods.
  2. Monitoring Command Execution with lastcomm:
    • The lastcomm command is another powerful feature of these tools. It logs every command executed by users, along with details such as the time of execution and the command’s duration. This can be extremely helpful in tracking down suspicious activities or understanding user behavior.
  3. Resource Usage with sa:
    • The sa command provides a summary of resource usage, including the number of processes executed and the amount of CPU time consumed. By analyzing this data, administrators can detect patterns that may indicate performance bottlenecks or resource misuse.

Practical Applications #

Beyond monitoring, acct and psacct tools are also useful in scenarios where system administrators need to generate reports for auditing purposes. For example, a report generated using these tools could help in compliance audits by providing a clear record of user activities over time.

Moreover, in high-security environments, these tools can serve as a first line of defense by alerting administrators to unusual patterns of activity, such as a user suddenly running a large number of processes or consuming an unusual amount of CPU time.

Conclusion #

In summary, the acct and psacct tools are essential for any Linux system administrator who needs to maintain tight control over user activities and system resource usage. By leveraging the various commands and options these tools offer, administrators can ensure their systems remain secure, efficient, and compliant with organizational policies.

Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on September 3, 2024

Powered by BetterDocs

Table of Contents
  • Installing acct/psacct
  • Using acct/psacct
  • Why Use Acct or Psacct?
  • Key Commands and Their Usage
  • Practical Applications
  • Conclusion

The last technical support you will ever need!

select one of our plans and start building the most wanted app/website available today. We make sure every aspect of the server maintenance are handled with  a level of expertise needed for growing your business!

Copyright 2024 techprovidence