sshkey
Manage SSH key pairs for authenticating to vServer instances.
Commands
| Command | Description |
|---|---|
| list | List all SSH keys |
| create | Generate a new SSH key pair |
| import | Import an existing SSH public key |
| delete | Delete an SSH key |
list
List all SSH keys in your project.
Synopsis
Options
--page (integer)
: Page number, 1-based. Default: 1.
--page-size (integer)
: Number of items per page. Default: 50.
--name (string)
: Filter by key name (substring match).
Examples
create
Generate a new SSH key pair. The private key is saved locally and the public key is registered in your project. Use --ssh-key-id when creating a server to inject the key.
Synopsis
Options
--name (required)
: SSH key name.
--output-dir (string)
: Directory to save the .pem private key file. Defaults to the system Downloads folder. If a file named <name>.pem already exists, the file is saved as <name>(1).pem, <name>(2).pem, etc.
Examples
# Generate a key and save the .pem to ~/Downloads
grn vserver sshkey create --name my-key
# Save the .pem to a specific directory
grn vserver sshkey create --name deploy-key --output-dir ~/.ssh
import
Import an existing SSH public key into your project.
Synopsis
Options
--name (required)
: SSH key name.
--public-key (string)
: SSH public key string, e.g. ssh-rsa AAAA....
--public-key-file (string)
: Path to a local file containing the SSH public key. Exactly one of --public-key or --public-key-file must be provided.
Examples
# Import from a file
grn vserver sshkey import --name my-key --public-key-file ~/.ssh/id_rsa.pub
# Import inline
grn vserver sshkey import --name my-key --public-key "ssh-rsa AAAA..."
delete
Delete an SSH key. Shows a confirmation prompt unless --force is used.
Synopsis
Options
--sshkey-id (required)
: SSH key ID.
--force (boolean)
: Skip the confirmation prompt.
--dry-run (boolean)
: Preview the deletion without executing it.