Skip to main content

Remove

Remove an SSH authorized key by fingerprint:

$ osapi client node user ssh-key remove --target web-01 \
--name deploy --fingerprint 'SHA256:abc123...'

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED
web-01 changed true

1 host: 1 changed

The key matching the given SHA256 fingerprint is removed from the user's ~/.ssh/authorized_keys file. Returns changed: false if the fingerprint is not found.

When targeting all hosts:

$ osapi client node user ssh-key remove --target _all \
--name deploy --fingerprint 'SHA256:abc123...'

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS CHANGED
web-01 changed true
web-02 changed true

2 hosts: 2 changed

Flags

FlagDescriptionDefault
-T, --targetTarget: _any, _all, hostname, or label (group:web)_all
--nameUsername to remove SSH key from (required)
--fingerprintSHA256 fingerprint of the key to remove (required)
-j, --jsonOutput raw JSON response