How to find recent cPanel login sessions via SSH?

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.
  • how to find cPanel login sessions via PuTTy, how to find cPanel login sessions via SSH, How to Find recent cPanel login sessions via SSH, RECENT CPANEL LOGIN SESSIONS
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What are some Basic SSH commands?

List of some basic SSH commands are: ls – This command is used to list all files and...

How to connect to SSH?

Putty is an open-source SSH client used to connect to a remote server. This article describes how...

20 Basic Linux Commands and their Uses.

Following are the top 20 basic Linux Commands with Live Examples that would definitely help you...

How to Block/Unblock IPs from SSH?

You can easily block or unblock IPs  from SSH. #1. Block An IP Address from SSH First of all,...

How to install CpCleaner in cPanel through SSH?

CpCleaner is a cPanel plugin created to give cPanel users the option to clean junk files that...