You can easily check the cPanel login sesssions via SSH by executing below given commands.

The following command will search /usr/local/cpanel/logs/session_log and output the last three dates upon which the cPanel account was accessed:

grep $USERNAME /usr/local/cpanel/logs/session_log | grep NEW | awk '{print $1}' | uniq | tail -n3
*Replace USERNAME with the cPanel username of which you want to check login sessions.

To search the recent cPanel session activity for all cPanel users on the server, execute the following command:

for user in $(whmapi1 listaccts | awk '/user:/ {print $2}'); do echo "The user $user last logged in on these dates:" ; grep $user /usr/local/cpanel/logs/session_log | grep NEW | awk '{print $1}' | uniq | tail -n3 ; done
You can also check the blog and video tutorial to get in detailed information.
Was this answer helpful? 0 Users Found This Useful (0 Votes)