Get Virtualizor

Generate Keys

Use the generate ssh keys API to generate new pair of keys.

HTTP Request

https://hostname:4085/index.php?act=create&generate_keys=1

Parameters

NameMethodValueDescriptionRequired
actGETcreateThe action specified to retrieve dataYes

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);
    $output = $admin->generate_keys();

    print_r(json_encode($output));  
?>

Curl

curl -k -X GET -L "https://hostname:4083/index.php?act=create& 
generate_keys=1&api=json&apikey=your_api_key& 
apipass=your_api_pass"

Output

{
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5zfj4jGDwtx5m.. root@lxc",
"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA+c34+Ixg8LceZs7bQUvUvS7m7GyRvz09a9A00gIwqaBdG0Hz\nEOo+6sdxAVdI8c3+LfhSQieQrxPmMjon0Obky/sF3YOwI+y09m6f6ZWcP+/raRnN\nb2I61EcfQJyoViYkzML3p6XAhP12qFJemATwqjtYAyygdZCzHtHJILZvyAQejeRd\nEj8ac1s8rVAw1B5TmxPMojyXgYsi0t9D8mIRCWuRHbxky0tcp6jA0U6HOyeB6SQp...\n-----END RSA PRIVATE KEY-----",
"path": "/var/virtualizor/ssh-keys/"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list