Technical article 109434

How can I keep non-root users from logging into the system under OpenServer 5.0.x?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4

Written · Last revised

Problem

I am in multiuser mode on SCO OpenServer Release 5, and I want to keep non-root users from being able to log in.

Solution

First, determine what the users are running.

If the users are all running one of the following shells:

Bourne Shell (sh)
Korn Shell   (ksh)
Restricted Korn Shell (rksh)
Take these steps:
# cd /etc
# cp profile profile.orig

After the /etc/profile file has been copied, edit the file and add the following (under the line that contains "umask 022"):

if [ "$LOGNAME" != "root" ]
then
  clear
  echo "System is unavailable"
  exec /bin/true
fi
Now save and exit the file.
Note: The string in the "echo" statement can be changed to display
whatever message you want users to see when they log in.  Be sure
that the message is contained within the double quotes.

If you have users that are using the C-Shell (csh), do the following:

# cd /etc  <enter>
# cp cshrc cshrc.orig

After the /etc/cshrc file has been copied, edit the file and add the following (under the line that contains "umask 022"):

if ( "$LOGNAME" != "root" ) then
    clear
    echo "System is unavailable"
    exec /bin/true
endif

As in the previous example, the "echo" statement can be modified.

NOTES:    You can either comment out the section you added when you want
          non-root users to be able to log in, or you can move the original
          file back into place overwriting the modified file.  You may want
          to copy the modified file as a backup for future usage.

If for some reason the script is modified so that root can no longer log in (for example, != "root" is stated as = "root"), you can shut down and restart the system (or issue an "init 1" command while logged in as root) and enter single-user mode to remove the modifications to the script.

There is another script that can work for disabling the logins which
has more features than the above modifications.  This file can be
found at:
ftp://ftp.armory.com./pub/admin/logins

Note that this script is not supported by SCO.

From the Xinuos technical article database, record 109434. Reproduced with permission. The original is at www.sco.com/ta/109434, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

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.