Skip to content

generate-ssh-key

Generate a new SSH key.

Syntax:

shell
sfiler-cli [options] generate-ssh-key [command options]
Command optionsRequired / OptionalDescription
-aRequiredThe key alias (the key alias must be unique).
-ksRequiredThe key size (possible values are : 1024, 2048, 3072).
-dammOptionalIndicates the behavior if the specified alias already exists in the database. Possible values are: fail, replace or generate-new. Default value: fail.

Example:

shell
./sfiler-config-cli.sh -l my-user -p my-password -cf "conf/sfiler.conf" generate-ssh-key -a "My SSH Key" -ks 3072

The execution of this command will generate a new SSH key with a size of 3072 bits and the alias "My SSH Key".

If the same command is executed again, the command will return an error because the alias "My SSH Key" already exists. To prevent this error, the -damm option can be used to specify the behavior if the alias already exists in the database.

The possible values are:

  • fail : the command will return an error (default value).
  • replace : the existing key with this alias will be deleted and the new key will be generated with the same alias.
  • generate-new : a new alias will be generated based on the one specified and a new key will be generated with this new generated alias.

When comes the time to generate a new version of the key, it could be renewed by running the same command with the same alias and the -damm option set to replace.

shell
./sfiler-config-cli.sh -l my-user -p my-password -cf "conf/sfiler.conf" generate-ssh-key -a "My SSH Keys" -ks 3072 -damm replace