Skip to main content

Create

Create an SSH authorized key.

The agent adds the key to the end of the ~/.ssh/authorized_keys file of the user. If the file or the ~/.ssh directory does not exist, the agent makes it. The permissions are 700 for the directory and 600 for the file.

osapi client node user ssh-key create

Examples​

osapi client node user ssh-key create --target web-01 \
--name deploy --key 'ssh-ed25519 AAAA... user@laptop'
osapi client node user ssh-key create --target _all \
--name deploy --key 'ssh-ed25519 AAAA... user@laptop'

Result​

If the key already exists (the same fingerprint), the command returns changed: false.

Flags​

FlagDescriptionDefault
--keyFull SSH public key line (required)
--nameUsername to add SSH key for (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file/etc/osapi/osapi.yaml
-T, --targetTarget: _all, _any, hostname, or label (group:web.dev)_all
--urlURL the client will connect tohttp://0.0.0.0:8080

Output tells how the result is printed, and what --json gives.