Technical article 105871

How do I exclude root and other users from the idleout command?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6

Written · Last revised

Problem

Normally any user, including root, will be logged out after the
"idleout" time defined in /etc/default/idleout has expired for
that user's login.  However, some environments require that a user
or users not be logged out when idleout has expired.
NOTE:     The idleout command is not enabled by default.

Solution

The System Administrator will need to edit /usr/bin/idleout to exclude any users that are not to be logged out when idleout expires.

Note: Before editing /usr/bin/idleout, copy that file to /usr/bin/idleout.out.

As an example, if two users, root, and a user, nonroot, are to be excluded from being logged out by idleout, edit /usr/bin/idleout at the line (approximately line 183):

$6 == "." { next }      \
so that it reads:
$6 == "." || ( $1 == "root" ) || ( $1 == "nonroot" ) { next }\

In this example, after editing that line the "killer" function should read:

            killer() {
                TMPFILE=/tmp/kill$$
                LANG=C who -u > $TMPFILE
                pids=`awk '                             \
                    $6 == "." || ( $1 == "root" ) || ( $1 == "nonroot") { next
}\
                    $6 == "old" { print $7 ; next }     \
                    {   i=index($6,":");                \
                        x=substr($6,1,i-1);             \
                        y=substr($6,i+1,length($6)-i);  \
                    } \
                    x > h  { print $7 ; next } \
                    x == h && y+0 >= m+0 { print $7 ; next } \
                    ' h=$1 m=$2 $TMPFILE `
                [ -n "$pids" ] && kill -9 $pids
                rm $TMPFILE
            }

Note: In the above function and throughout /usr/bin/idleout, the characters "\" are important and must not be removed.

To enable idleout, either run /usr/bin/idleout from the command line as root for a single instance, or modify /etc/rc2.d/S88USRDEFINE with a new line:

/usr/bin/idleout

This enables idleout when the system is running in multiuser mode.

NOTE:     An unsupported "super-idleout" ksh script that is configurable can
          be found at:
ftp://ftp.armory.com./pub/admin/nidleout

See also

The /etc/default/idleout file.
man idleout(ADM), getut(S), kill(S), who(C)

From the Xinuos technical article database, record 105871. Reproduced with permission. The original is at www.sco.com/ta/105871, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.