# pw ssh-key rotate

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

## pw ssh-key rotate

Replace your workspace SSH key with a new one

### Synopsis

The **pw ssh-key rotate** command replaces your workspace SSH key. A running
workspace receives the new key within seconds; a stopped one at its next
start.

The old key stops working at once, so reconnects that still use it may fail.
Use **--grace-period-hours** to keep it working for up to 24 hours. After the
rotation, add the new public key to any cluster where you added the old one
by hand.

```
pw ssh-key rotate [flags]
```

### Examples

```
  # Rotate your key; the old one stops working at once
  pw ssh-key rotate
  
  # Keep the old key working for 4 more hours
  pw ssh-key rotate --grace-period-hours 4
  
  # Skip the confirmation prompt and print the result as JSON
  pw ssh-key rotate -f -o json
```

### 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
  -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 ssh-key](/docs/cli/pw/ssh-key)	 - Show or rotate your workspace SSH key
