Operating System - HP-UX
1825803 Members
2542 Online
109687 Solutions
New Discussion

Re: disable /enable users.

 
SOLVED
Go to solution
chapaya_1
Frequent Advisor

disable /enable users.

Hi ,

1. How do i disable a user with command line ?
2. How do i verify it by command?
3. How do i enable it back ?

BYE
15 REPLIES 15
Luk Vandenbussche
Honored Contributor
Kasper Hedensted
Trusted Contributor
Solution

Re: disable /enable users.

Hi,

1:
/usr/lbin/modprpw -l -m alock=YES username

2:
/usr/lbin/getprpw -lrm lockout username

this command gives this output:
0000010 ( which means - admin lock )

3:
/usr/lbin/modprpw -lk username


for more info man modprpw and getprpw

Cheers,
Kasper
Sivakumar TS
Honored Contributor

Re: disable /enable users.


Hi,

To disable a user

#passwd -l


Do,

#passwd

and assign a passwrod to enable it back

With Regards,

Siva.
Nothing is Impossible !
Arunvijai_4
Honored Contributor

Re: disable /enable users.

Hello,

1. How do i disable a user with command line ?

# passwd -l

2. How do i verify it by command?

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=726139

3. How do i enable it back ?

# passwd

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Ajitkumar Rane
Trusted Contributor

Re: disable /enable users.

Chapaya,

Disable/Lock a user account

# passwd -l loginid

To unlock/enable a user's account that has become disabled
#modprpw -k loginid


Rgds,

Ajit

Amidsts difficulties lie opportunities
chapaya_1
Frequent Advisor

Re: disable /enable users.

Hi All ,

My system is in trusted mode , is it make difference ?

BYE
Arunvijai_4
Honored Contributor

Re: disable /enable users.

Yes,

In case of trusted mode, you can follow these steps,

# /usr/lbin/modprpw -k uname

For other queries, use this thread,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=955231

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: disable /enable users.

Non-trusted mode:

1) passwd -l
2) Login with that user from terminal or passwd -s
3) passwd -d

Trusted Mode:

1) modprpw alock=YES
2) getprpw -a
3) modprpw -k

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: disable /enable users.

Use the attached document for trusted systems.

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: disable /enable users.

Use the attached document for trusted systems.

Thanks to Bharat ;)

--
Muthu
Easy to suggest when don't know about the problem!
chapaya_1
Frequent Advisor

Re: disable /enable users.

Thanks all !!

Kasper ,

how do i get lockout parameter from getprpw ??
Steven E. Protter
Exalted Contributor

Re: disable /enable users.

Shalom,

man getprpw

This one works with trusted systems. If your system is not trusted, it may not be useful for you.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Arunvijai_4
Honored Contributor

Re: disable /enable users.

Hello,

# /usr/lbin/getprpw -lrm lockout username

Take a look at # man getprpw.


lockout returns the reason for a lockout in a "bit" valued
string, where 0 = condition not present, 1 is
present. The position, left to right represents:

1 past password lifetime
2 past last login time (inactive account)
3 past absolute account lifetime
4 exceeded unsuccessful login attempts
5 password required and a null password
6 admin lock
7 password is a *

-Arun

P.S Remember to assign points.
"A ship in the harbor is safe, but that is not what ships are built for"
Cem Tugrul
Esteemed Contributor

Re: disable /enable users.

How about the script below?

echo "THE USERS BELOW LOCKED:\r"
for USER in $(listusers | awk '{print $1}'|egrep -v "sshd|smbnull|tools|tbase")
do
lock_pos=$(/usr/lbin/getprpw -r -m lockout $USER)
user_name=$(grep $USER /etc/passwd|awk -F: '{print $5}')
if [ $lock_pos != "0000000" ]
then
echo "$USER $user_name $lock_pos"
fi
done
#end script

#man getprpw

lockout returns the reason for a lockout in a "bit" valued
string, where 0 = condition not present, 1 is
present. The position, left to right represents:

1 past password lifetime
2 past last login time (inactive account)
3 past absolute account lifetime
4 exceeded unsuccessful login attempts
5 password required and a null password
6 admin lock
7 password is a *

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Cem Tugrul
Esteemed Contributor

Re: disable /enable users.

if you wish i can send you a script for to
"unlock" users who are locked!!!
:-))
Good Luck,
Our greatest duty in this life is to help others. And please, if you can't