Operating System - HP-UX
1832541 Members
4239 Online
110043 Solutions
New Discussion

Re: Single login / Console shutdown

 
SOLVED
Go to solution

Single login / Console shutdown

Hi All,

Have two queries (HPUX):

1) Can we restrict single login to each user, and a second simultanious login from another network address should be refused, till the earler connection has been closed

2) Can we restrict the access to reboot the server only to console? If yes , how?

Thanks,
Srini
It Has Been...
6 REPLIES 6
Muthukumar_5
Honored Contributor
Solution

Re: Single login / Console shutdown

1) Yes. You can control with /etc/profile as,

IP=$(who -mu | awk '{ print $NF }')
who -u | grep -q "$IP"
if [ ${?} -eq 0 ]
then
echo "You are having another sessions. Plz use that.
sleep 1
exit 1
fi

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Single login / Console shutdown

2) Can we restrict the access to reboot the server only to console?

Using /etc/shutdown.allow file, you can do it.

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Single login / Console shutdown

2) /etc/shutdown.allow file will be blank by default so that only root user can able to do shutdown.

see man 1m shutdown

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Single login / Console shutdown

Arunvijai_4
Honored Contributor

Re: Single login / Console shutdown

You can acheive #2 by adding an entry into /etc/shutdown.allow

/etc/shutdown.allow Authorization file.

The file contains lines that consist of a system host name
and the login name of a user who is authorized to reboot or
halt the system. A superuser's login name must be included
in this file in order to execute shutdown. However, if the
file is missing or of zero length, the root user can run the
shutdown program to bring the system down.

This file does not affect authorization to bring the system
down to single-user state for maintenance purposes; that
operation is permitted only when invoked by a superuser.

A comment character, #, at the beginning of a line causes
the rest of the line to be ignored (comments cannot span
multiple lines without additional comment characters).
Blank lines are also ignored.

The wildcard character + can be used in place of a host name
or a user name to specify all hosts or all users,
respectively (see hosts.equiv(4)).
"A ship in the harbor is safe, but that is not what ships are built for"
RAC_1
Honored Contributor

Re: Single login / Console shutdown

1. There are multiple ways to allow n number of simultaneous logins. You can do certain code in /etc/profile.
But system also has in-built file to control this. man 4 security. you will have to prepare file /etc/default/security for it and it will have following

NUMBER_OF_LOGINS_ALLOWED=1

2. Use /etc/shutdown.allow file.
There is no substitute to HARDWORK