List SSH Keys

Use list ssh keys API to get list of sshkeys added in users through enduser panel.

HTTP Request

https://hostname:4085/index.php?act=users&list_ssh_keys=1

Parameters

NameMethodValueDescriptionRequired
actGETusersThe action specified to carry out operation and return dataYes
list_ssh_keysGETIntPass this to list sshkeysYes

NOTE : SSH keys should be added in User through enduser.

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

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

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);
    $uid = USERID;
    $output = $admin->list_sshkeys($uid);

    print_r(json_encode($output));
?>

Output

{
   "ssh_keys":{
      "1":{
         "keyid":"1",
         "name":"lxc",
         "value":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMMjek5GWU2ySGHWBKt7cNfiIGk4TcFnO2YUaw4Ko9qb91T5hu7KvYhyQ7YTaHpIzCh2\/ten6MK8RaQsseuWvIwZHKHc340IpZ2hGriXavTZtnijdRbuSWH8iIbeqtmuHqLeydpf6ArkpFvwq8dtRsC\/VGQo0TrwfRSO\/QEc3K+pGKCO8lbrmQM1pIwew0GwRVKhcLVJy\/SDnP2hQY6KAAUa5V5Dk9fQuORCuPZG69cuQaZNrUKVXpSMjojDe2pbXGK6dRnp7sVeXDzrMH6rl5RZwp0Qc+5A5OsQtJ\/AYqg+EPHmoKU\/oA9WvDNH\/tUqZuG9q2Ru9dVPwQkSQnDF0v root@lxc.nuftp.com"
      },
      "6":{
         "keyid":"6",
         "name":"xcp",
         "value":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpbKJLKIxaNn+b\/n+XQwsqI7D\/wuABwlu2JiXdv+r7gCBJwtFKVahoXdJDgktGccYvWWvRvSVarrfHGTQbdKLfKCPdfpS4PdjV00PkFwRhZujzhe7jp33r1KA0fSsFcGgWprwI3A78aZBakbuhupTDv1KkrEsyvnLSNQpUqIGQBKS7o0UqbS+GZf1p8ndg9wjzhlPmk7ye0HsDN4sZukEPUzHffIG5G\/JwCQIjS9RLG33zieJHggAJa1gVI5qVR5XcfVMUjDjMBM7Qq6o7GXM3T\/AjeF5CBRAas3s\/NCaISktMjQqMssmribnXQwbtdfZF\/CjQOTlXHuqD+u5Jb4ZR root@xenserver-bgemknud"
      },
      "7":{
         "keyid":"7",
         "name":"xen",
         "value":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAoSrNg7n\/jVJtHMA+QYv3AAV6WYTmDo0bRxnAPAaiw3lhrn1hcLexFKU1kGbKPwksV58tvzQuYslyAffPJJHSg4\/R5LjRQW5RjCg3poxHvyOsDKfUN650R2IMA+LnplOY2PSMFQsh5vf+xUMYVXsk1StFZD5maYDoPRse7iQE2\/sA\/QhT1EUzCFeFCetfdPj20LMdc47\/Q3kBxyalRSAllrU8J\/1QzGNt7TDQFpZ0Obc1o1TsfoPi0PM7CnF0EiFWf4Ag7roVQzub6EKYdeSKMvOrnIOUbQznfwnT\/tJAQpxa6zRaB\/KozEtVUxsidn4XttGEata2iuh5nJ7zKGuJsQ== root@xen.nuftp.com"
      },
      "8":{
         "keyid":"8",
         "name":"kvm",
         "value":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxHxXCHPNDn7uRf9ESrVHot5wYXwwUmGwLp7nPV0HJHT77YzbVEBi\/euAWbz59MQODVKnTJeAScf4y6z2\/emR+VgGTHNuCjMXb4fwaDi1Iij\/YdGiNJwkV5ezOs0LR1sI8a+XgRK2Cbuxowjubt1pOpLyoGOB1DPZUPw4mRE1p3tBK3SptBQe4qhUcYwCMitjFOUYCAziEPu36ySg46KaZXTSNERi4wDKcCf9UEgAqRUS2MlqvWiJjU7tKTiWNszl+kzVBZHJ0zwmfGIUk6h\/5rhBbt1C6LD5yUbRkJqfX1B8BmZZCXw\/BmUj\/eHYKXWeymqyxWjKzYC3AZ+FAeXU0w== root@kvm.nuftp.com"
      }
   }
}
Was this helpful to you?