Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Find What IP Address cPanel Site Is Using via Command Line  (Read 2099 times)

0 Members and 1 Guest are viewing this topic.

vinayakk

  • Guest
Find What IP Address cPanel Site Is Using via Command Line
« on: December 31, 2013, 07:01:44 am »
As a sysadmin, for some reason, I needed to find the IP address my websites were using on cPanel. This is probably a hard way but it works.

A huge amount of information is stored in the cPanel user file. Here’s a sample:

    $ cat /var/cpanel/users/testusername

    #cPanel — If you edit this file directly you must run /scripts/updateuserdomains after to rebuild the cache
    BWLIMIT=5242880000
    CONTACTEMAIL=admin@domain.com.au
    CONTACTEMAIL2=
    DEMO=0
    DNS=primarydomain.com.au
    FEATURELIST=default
    HASCGI=0
    IP=123.45.67.89
    LANG=english
    MAXADDON=5
    MAXFTP=5
    MAXLST=5
    MAXPARK=5
    MAXPOP=5
    MAXSQL=5
    MAXSUB=5
    OWNER=root
    PLAN=simple
    RS=x3
    STARTDATE=1238043252
    USER=testusername

When you start parking domains and using addon domains, they also appear under this file as DNS1=domain.com, etc.

I use this command to extract the IP address out of this file.

    $ cat /var/cpanel/users/putusernamehere | grep ‘IP=’ | cut -d’=’ -f2
    123.45.67.89

Thanks  :)