{"id":465,"date":"2024-08-29T11:01:51","date_gmt":"2024-08-29T11:01:51","guid":{"rendered":"https:\/\/249host.com\/tutorials\/?p=465"},"modified":"2024-08-30T07:20:16","modified_gmt":"2024-08-30T07:20:16","slug":"single-use-auto-login-url-for-whm-cpanel","status":"publish","type":"post","link":"https:\/\/249host.com\/tutorials\/single-use-auto-login-url-for-whm-cpanel\/","title":{"rendered":"How To Generate A Single-use Auto-Login URL For WHM\/cPanel\/Webmail?"},"content":{"rendered":"<p>This article will explain how to generate a Single-use Auto-Login URL For WHM from server SSH or terminal \/Putty.<\/p>\n<p>Root SSH access to the server is required in order to run any of the following commands.<\/p>\n<p>There are quite a few occasions where you might need to generate a one-time login URL (AKA a login session) to any of the cPanel-related interfaces (WHM\/cPanel\/Webmail). You might have lost your password and need to log into the interface to reset the password.<\/p>\n<p>There are times where you might need to provide a developer login access, but you want the access to be only an one-time access. And many other situations where having the capability to generate a temporary user session would come in handy. This capability is built into your cPanel installation and can be achieved in quite a few different ways. Here we will discuss the most convenient ways to achieve such a task.<\/p>\n<h2><strong><span class=\"wysiwyg-font-size-x-large\">Steps: Single-use Auto-Login URL For WHM<\/span><\/strong><\/h2>\n<p><strong><span class=\"wysiwyg-font-size-large\">The WHM Interface:\u00a0<\/span><\/strong><\/p>\n<p>There are two ways to create a temporary user session to the WHM interface. For the first one, you need to log into the <a href=\"https:\/\/www.squarebrothers.com\/cpanel-hosting-india\/\" target=\"_blank\" rel=\"noopener\">cpanel hosting<\/a> server via SSH as the root user and run the following command:<\/p>\n<pre id=\"CreateaUserSessionusingAPI1-WHM\">\/scripts\/whmlogin<\/pre>\n<p>This script will generate a temporary login URL to the WHM interface. The output looks like this:<\/p>\n<pre>[root@nstest ~]# \/scripts\/whmlogin\r\nhttps:\/\/nstest.com:2087\/cpsess7282232754\/login\/?session=root%3aHak9mOuaQmg_Y1B1%3acreate_user_session%2c43f4f05df97418b78c1bbb962e06c000\r\n[root@nstest ~]#<\/pre>\n<p>You need to copy and paste the above URL into the browser&#8217;s search bar and then you will be able to log into the WHM interface directly without having to enter any login credentials.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-471 size-full\" src=\"https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin.png\" alt=\"Single-use Auto-Login URL For WHM\" width=\"1718\" height=\"76\" srcset=\"https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin.png 1718w, https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin-300x13.png 300w, https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin-1024x45.png 1024w, https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin-768x34.png 768w, https:\/\/249host.com\/tutorials\/wp-content\/uploads\/2024\/08\/whmlogin-1536x68.png 1536w\" sizes=\"auto, (max-width: 1718px) 100vw, 1718px\" \/><\/p>\n<p>Alternatively, you can use the <code class=\"perl plain\">create_user_session<\/code> API function call to achieve the same:<\/p>\n<pre><span class=\"wysiwyg-font-size-large\"><strong>whmapi1 create_user_session user=root service=whostmgrd<\/strong><\/span>\r\n\r\n---\r\ndata:\r\ncp_security_token: \/cpsess0757885636\r\nexpires: '1604928498'\r\nservice: whostmgrd\r\nsession: root:cViC4b9uttvOWMUW:create_user_session,d9ed611d46eb58c80e2add6c5ef2963b\r\n<strong> url: https:\/\/10x.xx.xx.xx:2087\/cpsess0757885636\/login\/?session=root%3acViC4b9uttvOWMUW%3acreate_user_session%2cd9ed68c80e2add6c5ef2963b<\/strong>\r\nmetadata:\r\ncommand: create_user_session\r\nreason: Created session\r\nresult: 1<\/pre>\n<p>Here you can use the URL outputted (highlighted) when the above command is executed.<\/p>\n<p id=\"CreateaUserSessionusingAPI1-cPanel\" class=\"auto-cursor-target\"><strong><span class=\"wysiwyg-font-size-large\">The cPanel Interface:\u00a0<\/span><\/strong><\/p>\n<p>Similarly, for the cPanel and the Webmail interfaces, we can use the above API call to generate the temporary URL: (Here you need to replace the cPanel user <code>cptest<\/code>\u00a0with the user for whom you wish to create the temporary URL)<\/p>\n<pre class=\"syntaxhighlighter sh-midnight nogutter perl\">whmapi1 create_user_session user=cptest service=cpaneld<\/pre>\n<p id=\"CreateaUserSessionusingAPI1-Webmail\" class=\"auto-cursor-target\"><strong><span class=\"wysiwyg-font-size-large\">The Webmail Interface:\u00a0<\/span><\/strong><\/p>\n<p>(You need to replace the email account\u00a0<code>test@cptest.tld <\/code>with the account for which you wish to create the temporary URL):<\/p>\n<pre id=\"highlighter_929837\" class=\"syntaxhighlighter sh-midnight nogutter perl\">whmapi1 create_user_session user=test@cptest.tld service=webmaild<\/pre>\n<p>From the above post you know how to create Single-use Auto-Login URL For WHM from SSH or terminal.<\/p>\n<p>To understand and know how to save individual email in cPanel webmail <a href=\"https:\/\/249host.com\/tutorials\/saving-individual-emails-in-cpanel-webmail\/\">clickhere<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will explain how to generate a Single-use Auto-Login URL For WHM from server SSH or terminal \/Putty. Root SSH access to the server is required in order to run any of the following commands. There are quite a few occasions where you might need to generate a one-time login URL (AKA a login [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":476,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,1,11],"tags":[26,59,58],"class_list":["post-465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-control-panel","category-general","category-linux","category-security","tag-cpanel","tag-webmail","tag-whm"],"_links":{"self":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/comments?post=465"}],"version-history":[{"count":10,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/465\/revisions"}],"predecessor-version":[{"id":480,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/posts\/465\/revisions\/480"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/media\/476"}],"wp:attachment":[{"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/media?parent=465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/categories?post=465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/249host.com\/tutorials\/wp-json\/wp\/v2\/tags?post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}