Public Keys
A PublicKey is used to authenticate to Files.com via SFTP (SSH File Transfer Protocol). This method of authentication allows users to use their private key (which is never shared with Files.com) to authenticate themselves against the PublicKey stored on Files.com.
When a user configures their PublicKey, it allows them to bypass traditional password-based authentication, leveraging the security of key-based authentication instead.
Note that Files.com's SSH support is limited to file operations only. While users can securely transfer files and manage their data via SFTP, they do not have access to a full shell environment for executing arbitrary commands.
When generating new SSH keys, here are the available options: Files.com supports multiple SSH key algorithms: RSA (default 4096 bits, range 1024-4096 in 8-bit increments), DSA (1024 bits only), Ed25519 (256 bits), and ECDSA (256, 384, or 521 bits). When generating keys, the system uses these default lengths unless a specific length is specified.
Files.com also supports importing additional key types that cannot be generated: security key types (sk-ecdsa-sha2-nistp256, sk-ssh-ed25519). RSA keys up to 8192 bits are also supported for import.
List Public Keys
Command
files-cli public-keys list
Output
Outputs a list of PublicKey objects according to the output format.
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Flags
| Flag | Description |
|---|---|
| --user-id= int64 | User ID. Provide a value of 0 to operate the current session's user. |
Additional Arguments
Show Public Key
Command
files-cli public-keys find
Output
Outputs a PublicKey object according to the output format.
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Flags
| Flag | Description |
|---|---|
| --id= int64 Required | Public Key ID. |
Create Public Key
Command
files-cli public-keys create
Output
Outputs a PublicKey object according to the output format.
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Flags
| Flag | Default | Description |
|---|---|---|
| --user-id= int64 | User ID. Provide a value of 0 to operate the current session's user. | |
| --title= string Required | Internal reference for key. | |
| --public-key= string | Actual contents of SSH key. | |
| --generate-keypair boolean | false | If true, generate a new SSH key pair. Can not be used with public_key |
| --generate-private-key-password= string | Password for the private key. Used for the generation of the key. Will be ignored if generate_keypair is false. | |
| --generate-algorithm= string | "rsa" | Type of key to generate. One of rsa, dsa, ecdsa, ed25519. Used for the generation of the key. Will be ignored if generate_keypair is false. |
| --generate-length= int64 | Length of key to generate. If algorithm is ecdsa, this is the signature size. Used for the generation of the key. Will be ignored if generate_keypair is false. |
Update Public Key
Command
files-cli public-keys update
Output
Outputs a PublicKey object according to the output format.
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Flags
| Flag | Description |
|---|---|
| --id= int64 Required | Public Key ID. |
| --title= string Required | Internal reference for key. |
Delete Public Key
Command
files-cli public-keys delete
Output
No output is returned.
Authorization Requirement
Not available to user API keys or sessions from users that are marked as Shared/Bot users.
Flags
| Flag | Description |
|---|---|
| --id= int64 Required | Public Key ID. |
The PublicKey Object
Some of the commands above return a PublicKey object. The attributes of this object are listed below.
| Attribute | Description |
|---|---|
| id int64 | Public key ID |
| workspace_id int64 | Workspace ID (0 for default workspace). |
| title string | Public key title |
| created_at date-time | Public key created at date/time |
| expires_at date-time | Public key expiration date/time |
| expired boolean | Is this public key expired? |
| fingerprint string | Public key fingerprint (MD5) |
| fingerprint_sha256 string | Public key fingerprint (SHA256) |
| status string | Only returned when generating keys. Can be invalid, not_generated, generating, complete Possible values: error, not_set, to_be_generated, generating, complete |
| last_login_at date-time | Key's most recent login time via SFTP |
| generated_private_key string | Only returned when generating keys. Private key generated for the user. |
| generated_public_key string | Only returned when generating keys. Public key generated for the user. |
| username string | Username of the user this public key is associated with |
| user_id int64 | User ID this public key is associated with |