How to create or get ssh_credential id from gvm-cli commands

I want to create ssh and smb credentials from gvm-cli, I see no create command for them present in the documentation (https://docs.greenbone.net/API/GMP/gmp-7.0.html#command_create_target)but in create target command I see there is an option to pass ssh_credential id but not sure how or where to get it.

create_target_ssh_credential
** = element ssh_credential**
** {**
** attribute id { uuid }**
** & create_target_ssh_credential_port?**
** }**

create_target_ssh_credential_port
** = element port**
** {**
** text**
** }**

create_target_smb_credential
** = element smb_credential**
** {**
** attribute id { uuid }**
** }**

create_target_esxi_credential
** = element esxi_credential**
** {**
** attribute id { uuid }**
** }**

please help me with a solution

You have to create a ssh credential via create_credential command first

https://docs.greenbone.net/API/GMP/gmp-7.0.html#command_create_credential

1 Like

I am using the below create_credential command to create credentials

gvm-cli socket --socketpath /run/gvmd.sock -c gmp.conf --xml="<CREATE_CREDENTIAL>test2usernamepassword@123</CREATE_CREDENTIAL>"

How can I create ssh_credential or smb_credential from the above command, I don’t see any such attribute defined for this command,

*** Command**
** * < name > **

A name for the credential.

** * < comment > ?**

A comment on the credential.

** * < copy > ?**

The UUID of an existing credential.

** * < allow_insecure > ?**

Whether to allow insecure use of the credential.

** * < certificate > ?**

The certificate of the credential.

** * < key > ?**
** * < phrase > **

Key passphrase.

** * < private > **

Private key.
** * < login > ?**

The user name of the credential.

** * < password > ?**

The password for the credential login.

** * < auth_algorithm > ?**

Authentication algorithm for SNMP, either md5 or sha1.

** * < community > ?**

The SNMP community.

** * < privacy > ?**
** * < algorithm > **

The SNMP privacy algorithm, either aes or des.

** * < password > **

The SNMP privacy password.
** * < type > ?**

The type of credential to create.
*** Response**
** * @ status (status)**
** * @ status_text (text)**
** * @ id (uuid)**