Posts RSS Comments RSS 48 Posts and 155 Comments till now

Read the Login accounting file

This hint is for people who don’t have Apple Remote Desktop 3.0 and may need to know whose been logging into a machine. This can come in particular use if you run a public computing lab and need to know whose been logging into your computers at 2 AM or need to know if a certain student was using a computer at a certain time.

The login stats are kept in /var/log/ in a file named wtmp

Go to Terminal to run the commands below. You either have to be logged in as root or run them as sudo.

To find out how many times people have logged in during the current month:

ac -p

To find out when people have logged in during the current month:

last

To find out this information for previous months you must unzip the log files in /var/log

Example:

gunzip /var/log/wtmp.0.gz will unzip the previous months log files

After you have unzipped you can run the following:

To find out when people logged in during that month:

last -f "path to unzipped file"

Example:

last -f /var/log/wtmp.0

To find out how many times people logged in that month:

ac -p -w "path to file name"

Example:

ac -p -w /var/log/wtmp.0

One Response to “Read the Login accounting file”

  1. […] data could be gotten using the last command in Terminal. You can see more about last at my post here. However, these folks were not computer-savvy and needed the information in a comma-delimited file. […]