Ram
Ram

Reputation: 1213

Idle timeout Bourne-style shell

Is there any way to timeout idle users in Bourne-style shell (/bin/sh).

man sh does not talk about it.

http://www.freebsd.org/cgi/man.cgi?sh

TIMEOUT or TMOUT shell env variables in /etc/profile works fine for bash and ksh.

http://linux.die.net/man/1/bash

C-Shell has /etc/csh.logout set autologout option.

http://www.freebsd.org/cgi/man.cgi?csh

I don't find any similar option in case of sh (/bin/sh).

UPDATE:

/bin/sh seems to be reading /etc/profile.

Added following entries in /etc/profile:

TMOUT=60
readonly TMOUT
export TMOUT 

After login:

$ env
USER=test
HOME=/var/home/test
LOGNAME=test
TERM=vt100
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/sbin:/opt/bin
SHELL=/bin/sh
TMOUT=60

/var/home/test/trace (sh debug logs):

token word TMOUT=60
pipeline: entered
reread token word TMOUT=60
reread token word TMOUT=60
reread token word TMOUT=60
reread token word TMOUT=60
reread token word TMOUT=60
reread token word TMOUT=60
token newline

But still, idle session does not get auto-logout. /bin/sh/ does not seem to be using TMOUT value.

Upvotes: 1

Views: 1058

Answers (1)

Roland Smith
Roland Smith

Reputation: 43503

Have a look at the doinkd port (sysutils/doinkd). From the package description;

The idle daemon (doinkd) monitors user activity and logs them off when predefined rules are met. These include session time, multiple logins, tty, idletime and group limits. Similar to the Unix idleout command, but much more configurable. Formerly idled.

Upvotes: 1

Related Questions