Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcvax!diku!olamb!kimcm
From: kimcm@olamb.UUCP (Kim Chr. Madsen)
Newsgroups: comp.unix.questions
Subject: Re: Disabling logins under System V
Message-ID: <298@olamb.UUCP>
Date: Thu, 16-Jul-87 05:44:09 EDT
Article-I.D.: olamb.298
Posted: Thu Jul 16 05:44:09 1987
Date-Received: Sat, 18-Jul-87 11:31:28 EDT
References: <905@woton.UUCP> <256@axis.fr>
Organization: AmbraSoft A/S (Denmark)
Lines: 36

In article <256@axis.fr>, philip@axis.fr (Philip Peake) writes:
> In article <905@woton.UUCP>, riddle@woton.UUCP (Prentiss Riddle ) writes:
> > I am looking for some advice about the preferred way to temporarily
> > disable all user logins under System V.  What I want is something
> > analogous to the BSD "/etc/nologin" file. 

> The easiest way that I can think of is to use /etc/profile.
> Its much less dangerous than playing with /etc/passwd or
> /etc/inittab.

Except that it will not allways work - user's who are not running the
/bin/sh or other shells that don't source the /etc/profile will not be
hindered by this approach...

The best way to do it is to use the init program to change the state of the
system - use "init s" to go to single user-mode mount the /usr and other
disks/partions you want to backup - do your backup and return to multiuser
state again by calling "init 2".

If you don't like this approach because you want to be able to login as a
non-root account (or whatever reason) you can maintain two password files
and have a shell-script switching between them when you change state to a
user defined state (don't use init state 3 - it is used for network in 
SYSV release 3.0 and later, but use state 4) put the shell script in
the directory /etc/rc4.d/ and return to state 2 when you're done with the 
backup.

If you use the latter method remember to kill active user processes (if
necessary) with the command /etc/killall - and don't forget to issue a
warning to all users so they can log off the system gracefully before you'll
have to kill them!

Finally if you have the sources for /bin/login you can hack it to check
whether /etc/nologin exists and if so prevent further logins.

					Kim Chr. Madsen.