[comp.unix.xenix] Keep them out!

gary@fryepro.UUCP (Gary L. Scorby) (05/26/90)

The system I use it running SCO Xenix 2.3.2.  Is there a command
that allows the super user to stop anyone from logging in for a
period of time?  I believe Berkley Unix stopped logins when the
file nologin was present in /etc.  SCO does not appear to do this.
Is there something similar?  Thanks in advance.
-- 

* Gary L. Scorby                                                        *
* gary@fryepro.UUCP                                                     *
* tektronix!percy!fryepro!gary                                          *

chip@chinacat.Unicom.COM (Chip Rosenthal) (05/27/90)

In article <304@fryepro.UUCP> gary@fryepro.UUCP (Gary L. Scorby) writes:
>[On SCO XENIX 2.3.2] Is there a command that allows the super user to stop
>anyone from logging in for a period of time?

No.  The "login" program does not support this kind of feature.  However,
there is hook in /etc/gettydefs which will help.  You can specify a program
to run in the 6th field rather than defaulting to /etc/login.  So, you might
create an /etc/loginchk from the following:

#include <stdio.h>
#define LOGINLCK "/etc/nologin"

main()
{
    if ( access(LOGINLCK,0) == 0 ) {
        fputs("Logins are temporarily disabled.  Try again later.\n",stderr);
        exit(1);
    }
    execl("/etc/login","login",(char *)NULL);
    fputs("loginchk: exec login failed\n",stderr);
    exit(1);
}

If you take this approach, "loginchk" should be installed owned by "bin"
with permissions 4500 (that is, setuid to bin).

An easier approach if all your users run the same shell, say /bin/sh,
is just stick:

	if [ -f /etc/nologin ] ; then
	    echo Logins are temporarily disabled.  Try again later.
	    exit 1
	fi

into /etc/profile.  For csh, change syntax appropriately and use /etc/cshrc.

*WARNING*  Before you go about doing anything like this, you should add
an escape hatch so that root can bypass this check, otherwise you can
lock the door behind you.

-- 
Chip Rosenthal                            |  You aren't some icon carved out
chip@chinacat.Unicom.COM                  |  of soap, sent down here to clean
Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt

srodawa@vela.acs.oakland.edu (Dr. Srodawa) (05/27/90)

In article <304@fryepro.UUCP> gary@fryepro.UUCP (Gary L. Scorby) writes:
>The system I use it running SCO Xenix 2.3.2.  Is there a command
>that allows the super user to stop anyone from logging in for a
>period of time?  I believe Berkley Unix stopped logins when the
>file nologin was present in /etc.  SCO does not appear to do this.
>Is there something similar?  Thanks in advance.

If you are just booting, give root password rather than ^D to stay
in single user mode.  If you are in multi-user mode, use shutdown.
Check its documentation for options.  Ron.

-- 
| Ronald J. Srodawa               | Internet: srodawa@unix.secs.oakland.edu |
| School of Engineering and CS    | UUCP:     srodawa@egrunix.UUCP          |
| Oakland University              | Voice:    (313) 370-2247                |
| Rochester, Michigan  48309-4401 |                                         |

davidsen@sixhub.UUCP (Wm E. Davidsen Jr) (05/27/90)

In article <304@fryepro.UUCP> gary@fryepro.UUCP (Gary L. Scorby) writes:
| The system I use it running SCO Xenix 2.3.2.  Is there a command
| that allows the super user to stop anyone from logging in for a
| period of time?  

  There was a thing like that in ISC SYS III (I do date myself, don't
I?) called "nonew". With SCO you can use a custom login program, either
in gettydefs or just as a replace for login, which execs login when allowed.
-- 
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me

pmb@sequim.UUCP (Peter Black) (05/28/90)

In article <1270@chinacat.Unicom.COM>, chip@chinacat.Unicom.COM (Chip Rosenthal) writes:
> In article <304@fryepro.UUCP> gary@fryepro.UUCP (Gary L. Scorby) writes:
> >[On SCO XENIX 2.3.2] Is there a command that allows the super user to stop
> >anyone from logging in for a period of time?
> 
> No.  The "login" program does not support this kind of feature.

Telinit can not only keep others from logging in, it will logoff anyone
who is on when executed.  Telinit uses states 0-6 and reads the file
/etc/inittab.  You can have several states on your machine, one for
disabling modems, another for disabling all logins to do backups, etc.
It will run out of cron very nicely also (modems).

If you are using a serial board with tty device names with other than
two characters, you must fix /bin/telinit to work with all length tty
names by changing the line reading:


	/^[01].tty..$/p" \

to read

	/^[01].tty.*$/p" \

Peter M. Black, Peter M. Black Real Estate Co., Inc.
P.O. Box 2227, 315 E. Washington Street, Sequim, WA 98382
Voice (PST): (206) 683-1171 or 800-962-7307, FAX: (206) 683-5415
E-Mail: {attmail,uunet}!sequim!pmb