# pw users ssh-key rotate

> Source: https://parallelworks.com/docs/cli/pw/users/ssh-key/rotate

## pw users ssh-key rotate

Replace a user's workspace SSH key with a new one

### Synopsis

The **pw users ssh-key rotate** command replaces a user's workspace SSH key.
Their running workspace receives the new key within seconds; a stopped one
at its next start. Requires the **org:users** role in the target
organization.

The old key stops working at once unless **--grace-period-hours** keeps it
for up to 24 hours. By default it uses the organization from your current
context. Use **--org** to target a different organization.

```
pw users ssh-key rotate [flags] <username>
```

### Examples

```
  # Rotate a user's key; the old one stops working at once
  pw users ssh-key rotate alice
  
  # Keep the old key working for 4 more hours
  pw users ssh-key rotate --grace-period-hours 4 alice
  
  # Rotate in another organization without the confirmation prompt
  pw users ssh-key rotate --org my-org -f alice
```

### Options

```
  -f, --force                    Skip confirmation prompt
      --grace-period-hours int   Hours the old key keeps working, 0 to 24 (0 stops it at once)
  -h, --help                     help for rotate
      --org string               Target organization (defaults to current context)
  -o, --output string            Output format (table, json) (default "table")
```

### Options inherited from parent commands

```
      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
  -v, --verbose                Enable verbose logging
```

### SEE ALSO

* [pw users ssh-key](/docs/cli/pw/users/ssh-key)	 - Show or rotate a user's workspace SSH key
