# sshd auto-logout



## Grafula (Oct 7, 2012)

Hi,

I'm running shhd on the server (FreeBSD 9) and remote users can log on without problems.

Now I want that they get logged out after a certain period of inactivity, say 30 mins.

I tried setting ClientAliveInterval and ClientAliveCountMax in sshd_config, but to no avail.


```
ClientAliveInterval 10
ClientAliveCountMax 3
```

I restarted sshd(8) (*/etc/rc.d/sshd restart*).

As I understand it, the above options should log the user out after 30 seconds of inactivity. But they are not logged out at all.

Thanks
--Ken


----------



## AlexJ (Oct 8, 2012)

NO, you understand it wrong.

```
ClientAliveInterval 10
ClientAliveCountMax 3
```
*SSHd* used this settings when it can't talk to a client. (network disruption for example)
This usually need to avoid ghost sessions in case if client loose connection. 
BTW, if you talking about 30 min you wrote it wrong, *ClientAliveInterval* should be specified in seconds(!!!)

Feature that you're looking for - provided by shell( keep in mind that not all of them support this feature ) but *SSHD*
Read tcsh(1) about *autologout* for example. /usr/ports/shells/bash use *TMOUT* environment variable for that and /bin/sh doesn't support this feature at all.


----------



## Grafula (Oct 8, 2012)

Thank You !!!

I obviously read wrong 

I have now added the line:

```
set     autologout=60
```
to the users' .cshrc and it works perfect.

BTW, autologout is in minutes, while ClientAliveInterval is -as you said- in seconds.


----------

