# IAM.SESSION.KILL

> End a login and close its connection.

URL: https://docs.hotkv.com/commands/iam-session-kill/

```
IAM.SESSION.KILL session-id | user
```

- Group: IAM
- Complexity: O(N) where N is the number of sessions
- HotKV Cloud: not available
- On-Premise: requires the enterprise-iam license feature

`IAM.SESSION.KILL` ends a session and closes the connection that has it. With a
session ID (from [IAM.SESSION.LIST](https://docs.hotkv.com/commands/iam-session-list/index.md)) it ends that
one. With anything else it is taken as a login name, `alice` or `ldap:alice`, and
ends every session of that user on this node.

Sessions belong to the node they are on, so this acts on the node you send it to,
and it is not copied to the replicas or the other nodes of a cluster. To log a
user out everywhere, run it on every node, or take their roles away with
[IAM.USER.UNASSIGN](https://docs.hotkv.com/commands/iam-user-unassign/index.md), which applies everywhere.

## Return value

An integer in RESP2 and RESP3: the number of sessions ended (`0` if there was
none), or the error
`NOLICENSE enterprise-iam requires a HotKV license. Contact sales@hotkv.com`.

## Examples

```
127.0.0.1:6379> IAM.SESSION.KILL 2
(integer) 1
127.0.0.1:6379> IAM.SESSION.KILL 2
(integer) 0
127.0.0.1:6379> IAM.SESSION.KILL alice
(integer) 2
```

## Compatibility

HotKV-only command.

## See also

[IAM.SESSION.LIST](https://docs.hotkv.com/commands/iam-session-list/index.md), [CLIENT KILL](https://docs.hotkv.com/commands/client-kill/index.md)