Monday, September 26, 2011

Creating secure remote logins to cPanel

July 1, 2010 by  
Filed under cPanel

1 Comment

To provide hosts with a simple way to allow users to login remotely, cPanel created a module. This module queries the cPanel server for a URL that allows access to cPanel, WHM or Webmail (depending on the request). This URL is good for a single use and the session is destroyed as soon as the URL is accessed.

Integrating cPanel Logins with 3rd Party Softwares
You may be wishing to provide a unified experience for customers by having them sign into your customer area and then simply handing them off cPanel interface. To do so, you can pull their login information from your records and then use cPanel::LogMeIn::get_loggedin_url() to get a URL to hand off to their browser which will give them access to cPanel, WHM or Webmail.

use lib ‘/usr/local/cpanel’;
use Cpanel::LogMeIn ();

my $user = USERNAME; #cPanel, WHM, or Webmail username being pulled from a database
my $pass = PASSWORD; #cPanel, WHM, or Webmail password being pulled from a database
my $host = DOMAIN; #Domain name associated with the cPanel, WHM or webmail account being pulled from a database
my $service = ‘cpanel’; #The service we want to login to (cpanel or whm or webmail)

my($login_ok,$login_message,$login_url) = Cpanel::LogMeIn::get_loggedin_url(

if ($login_ok) {
print “Location: $login_urlrnrn”;
} else {
print “Content-type: text/plainrnrn”;
print “LOGIN FAILED: $login_messagen”;

exit (0);

After retrieving their username, password and domain name from database, cPanel hands them off to Cpanel::LogMeIn::get_loggedin_url() which returns the URL that is good for a single use. Then, it prints that URL as the location in their browser which will take them to the URL.

GD Star Rating
a WordPress rating system
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Related posts:

  1. Using Webmail in cPanel control panel
  2. Secure and Optimize your Virtual Private Server (VPS)
  3. Disallow /cpanel, /webmail to be redirected to ssl/tls ports (2083, 2096)
  4. How to allow remote SQL connection to your site
  5. Install WordPress using Fantastico in cPanel


One Response to “Creating secure remote logins to cPanel”
  1. Megan Ally says:

    if you are going to get a VPS server make sure that it has cPanel coz it makes server maintennance easier.,*.

    GD Star Rating
    a WordPress rating system

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.