How to create a one-time login hash URL in DirectAdmin

One-time login URLs function allows you to generate an URL that will login the user automatically. By default, the URL is valid for 3 days. You can change this interval and other options via the command line options.

The command to generate the one-time login URL is:

# /usr/local/directadmin/directadmin --create-login-url user=USERNAME

where the USERNAME is the DirectAdmin username you want to create the URL for.

An example of output of the command for user admin is:

[root@web ~]# /usr/local/directadmin/directadmin --create-login-url user=admin
URL: https://web.plothost.com:2222/CMD_LOGIN_URL?hash=Rd5XcrGdmTjWDym8moaWPAbYTKBLIV7h9CEj1VMow3I904GmsqGIzroQCxlSTsAa4MH5pdrme9teDAO60eMxWANg888Z0G74dO8QzzCd95IKEgQCKmApvXV1gbaeqfjR3pr2m2ft6vEKccUvN
[root@web ~]#

Now, copy/paste the URL in your preferred web browser.

To change the default 3 days validity period, use:

# /usr/local/directadmin/directadmin --create-login-url expiry=[s,m,h,d,M,y] user=USERNAME

The following example will create an URL valid for one hour:

# /usr/local/directadmin/directadmin --create-login-url expiry=1h user=admin

To limit the URL to a specific IP, use the ips option in the command:

# /usr/local/directadmin/directadmin --create-login-url ips=IP1,IP2 user=USERNAME

Example that will allow the URL to be used on only one IP:

# /usr/local/directadmin/directadmin --create-login-url ips=11.22.33.44 user=admin

References:
One-Time Login Hash URL

Leave a Reply