Listing cPanel users UID more than 1000

Listing cPanel users ( UID more than 1000) from hash prompt.

Command to list all cpanel users from hash prompt

awk -F: ‘{if ($3 > 1000) {print $1}}’ /etc/passwd

To execute some shell script we need list of all cPanel users.   On cPanel server default setting is in such way it will create cPanel user with UID more than 1000.  That make very easy to list all cPanel users from /etc/passwd file using awk command.

1st column and 3rd column of /etc/passwd file contain username and UID. Above command checks if UID (3rd column value) is more than 1000 , if yes then print 1st column that is cPanel username.  As all columns are separated by “:” hence we used it as separator in command (-F:).

 

Leave a Reply

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