Have you needed to login to Web Hosting Manager (WHM) but haven’t had the password to hand?

It’s not something you’ve always got on hand especially if you’re in and out of SSH mainly, or as it has happened to some people whom have prodded me in the past, they’ve managed to completely forget the password – lost the post-it note you had it on eh? – now if you’re on a VPS and can get console access, or have a valid ssh key in place for root that you can SSH into, then you are in luck and getting access to WHM should be easy with the added bonus of not requiring any downtime!

This simple one liner will communicate with the WHM / cPanel API and generate you a unique session link that once visited, will log you straight in to your favourite hosting control panel,

whmapi1 create_user_session user=root service=whostmgrd locale=en

either grep the url, or just click it and it’ll log you straight in as ‘root’ in WHM.

using WHM API tool to request a session

Using the WHM-API tool to request a session for root access to cPanel/WHM