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.origAfter 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
fiNow 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.origAfter 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
endifAs 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/loginsNote that this script is not supported by SCO.