UAPI Functions - Session::create_temp_user

Description

This function creates a temporary user session. In earlier versions of cPanel & WHM, the system created temporary MySQL®/MariaDB users whenever a user logged in to cPanel via external session creation instead of password authentication. This caused high load and performance issues on systems with frequent logins.

As of cPanel & WHM version 54, the system no longer created temporary users for external session logins until a script or user accessed thephpMyAdmin feature or the backup functionality.

Third-party plugins that require access to temporary MySQL users (found in $ENV{'REMOTE_DBOWNER'}) will now need to call theSession::create_temp_user function in order to create the temporary users before they are available.

Important:

If you cannot update your system for whatever reason, the workaround is to update your scripts to call cPanel API 1 Functions -Cgi::phpmyadminlink , which will create a temporary user session for you.

Examples


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/Session/create_temp_user

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Create a temporary session.
$create_session $cpanel->uapi(
    'Session''create_temp_user'
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Create a temporary session.
my $create_session $cpliveapi->uapi(
    'Session''create_temp_user',
);

 cPanel Template Toolkit

<!-- Create a temporary session. -->
[% data = execute( 'Session', 'create_temp_user' ); %]

 Command Line

uapi --user=username Session create_temp_user

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{ 
 
   },
   "data":{ 
      "created":1,
      "session_temp_user":"cpses_reviY3ZSQK"
   }
}

 

Note:

Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

Parameters

This function does not accept parameters.

Returns

Return

Type

Description

Possible values

Example

created

 Boolean 

 Whether the function successfully created the temporary user session. 

  • 1 — Success. 
  • 0 — Failure.

1

 session_temp_user 

string

The temporary user's session ID.

A positive integer.

 cpses_reviY3ZSQK 

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....