1831101 Members
2958 Online
110019 Solutions
New Discussion

LOG IN

 
SOLVED
Go to solution
Richard Barcellano
Occasional Advisor

LOG IN

I want to limit the users from logging in more than once. How do I do this? We are using HP-UX 10.20 and K-class server. NIS is also being used.

Change is the world's constant
12 REPLIES 12
Dan Am
Frequent Advisor

Re: LOG IN

write an SUID script, that triggeres a deletion routine on the NIS-Master Server.

this gets started from a global login-file or the users ,say .dtprofile that you have to secure properly (i.e. ownwership root with r-x for everybody

my 0.02, have a try.

dan



do what you can. don't if you can't.
Anthony Goonetilleke
Esteemed Contributor
Solution

Re: LOG IN

I think this has been asked before maybe its time for a Forums FAQ :-) how many points would I get for that... Anyway back to the topic
try this..

In your /etc/profile add the following lines

USER=$(whoami)
NBCNX=`who -H | grep ${USER} | grep -v root | wc -l`

if [ ${NBCNX} -gt 2 ]
then
echo "MSG login restrited"
exit
fi

Minimum effort maximum output!
Richard Barcellano
Occasional Advisor

Re: LOG IN

I am not familiar with NIS.
How do I create that SUID script in NIS.
Please write the procedure.

Thank you very much
Change is the world's constant
Dan Am
Frequent Advisor

Re: LOG IN

please clarify:
do you want the user to be deleted after first login? that was my answer.

or do you want to have only one
login at a time ?
then Anthonys script points the way.
do what you can. don't if you can't.
Richard Barcellano
Occasional Advisor

Re: LOG IN

I want to have only one
login at a time.
Change is the world's constant
Richard Barcellano
Occasional Advisor

Re: LOG IN

In your /etc/profile add the following lines

USER=$(whoami)
NBCNX=`who -H | grep ${USER} | grep -v root | wc -l`

if [ ${NBCNX} -gt 2 ]
then
echo "MSG login restrited"
exit
fi


****

I followed this instructions but still users can login more than once.

The error I encountered was
/etc/profile [137] who: not found

One more thing, we are also using CDE Deskstop environment. Help is still needed.

Thank you in advance.
Change is the world's constant
Anthony Goonetilleke
Esteemed Contributor

Re: LOG IN

try specifiying the whole path for who

i.e /usr/bin/who
Minimum effort maximum output!
Richard Barcellano
Occasional Advisor

Re: LOG IN

I specified the whole path and no errors were encountered but I can still login more than once. I logged into the server using the local console of the server and another using a remote terminal. Both were successful.
For example, the user 'jessie' has logged in already and he wants to log in again using the same username using a remote terminal. How do I prevent Jessie from logging in again?



Change is the world's constant
Dan Am
Frequent Advisor

Re: LOG IN

if [ ${NBCNX} -gt 1 ] # (not two !)
then
echo "MSG login restrited"
exit
fi
do what you can. don't if you can't.
Dan Am
Frequent Advisor

Re: LOG IN

# watch it
# comment got wrapped
# (line 1 and two)
do what you can. don't if you can't.
Dan Am
Frequent Advisor

Re: LOG IN

(sorry for my staggered answer. rather early in the morning.)

if you are using cde,

1. cp /usr/dt/sys.dtprofile /etc/dt

2. add the script from anthony

3. make sure users don't have .dtprofile
in their home-directories.

should do the trick.

do what you can. don't if you can't.
Richard Barcellano
Occasional Advisor

Re: LOG IN

Should I also change Anthony's script from
grep -v root to grep -v jessie. To prevent Jessie from logging in twice?

I will be using jessie's account to test this and not root.

Change is the world's constant