Temporarily Disable User Account


 
Thread Tools Search this Thread
Operating Systems HP-UX Temporarily Disable User Account
# 1  
Old 01-22-2007
Temporarily Disable User Account

I want to temporarily disable a user account on HP-UX at the start of a script and renable the account at the end of the script. What would be the best method on HP-UX to temporarily disable a user account? I know of the passwd -l option that will lock the account, but I do not see a flag for unlocking the account. I was hoping to avoid messing with the /etc/passwd file if possible.

Has anyone performed something similar and how did you go about doing it? Thanks in advance.
# 2  
Old 01-22-2007
one suggestion may be :
To disable an account put an * in front of the account line in /etc/passwd.
To enable it again remove the * in front of the line.
# 3  
Old 01-24-2007
Depending on your version of HP-UX, change the "crypted password" field in the /etc/passwd or /etc/shadow file in a string which never can be generated.

Commonly a "*" or something like "NP" is used.

Whatever the password is, it can never result in a crypted string which is equal to "*" or "NP".

Too unlock the account, simply set a new password for the locked account using, as "root", the command "passwd <user>"
# 4  
Old 01-25-2007
You can always just
passwd -l <username> to lock it.
/usr/lbin/modprpw -l -k <username> will unlock it.
a CE taught me the last one... I think its a command used internally via sam.

Last edited by Eronysis; 01-26-2007 at 04:13 AM..
# 5  
Old 01-26-2007
You can use the below ones.

usermod -e 'yesterday' <username> (expire the user a/c)

usermod -s '/bin/false' <username> (set the shell to /bin/false)

Changing the shell to /bin/false will disable the user's ability to login.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Disable Inactive User in Solaris 11

Goal: To disable a Solaris user, after that user was inactive for X days. My understanding for linux was that there was no systematic way to disable inactive users, therefore we had to set a password expiration via /etc/default/passwd, MaxWeeks; then in /etc/default/useradd (/etc/shadow), the... (1 Reply)
Discussion started by: Drasavokian
1 Replies

2. Shell Programming and Scripting

Grep: a better way to temporarily disable colors?

i was just using gnu grep grep (GNU grep) 2.20 and when running a command i kept getting really weird results, namely that eval and echo and various combinations would not run the command BIN="${FFMPEG} -i ${INPUT} ${setX265} ${videoCrop} ${audioOptions} ${OUTPUT}.mkv" with this... (7 Replies)
Discussion started by: f77hack
7 Replies

3. Solaris

Disable telnet for a particular user

On Solaris 8 is there anyway to disable telnet for a particular user and not for entire system altogether? I would like the user to retain a shell and so creating a noshell like ftp account is not an option. (14 Replies)
Discussion started by: boshyd
14 Replies

4. Red Hat

cannot set user id: Resource temporarily unavailable (not open file/open process related)

First post, sorry to be a bother but this one has been dogging me. I have a process user (java application server) that trips a resource limit every couple weeks and need help finding what limit we're hitting. First, this is what's running: This is the error when jobs are run or the... (0 Replies)
Discussion started by: Katahdin
0 Replies

5. UNIX for Dummies Questions & Answers

Difference between : Locked User Account & Disabled User Accounts in Linux ?

Thanks AVKlinux (3 Replies)
Discussion started by: avklinux
3 Replies

6. AIX

How to disable user login infor?

If user login and don't do anything in 15 mins, the user is kicked off from the server. how to disable it? (5 Replies)
Discussion started by: rainbow_bean
5 Replies

7. Solaris

Root account - disable expiry

I couldnt find this in any other post - so hoping someone can help out. I want to set password expiry (or rather I have to) for a number of users on my solaris 9 system. I know i can set the following options in the /etc/default/passwd file to do it and then just type a passwd -f <username> to... (6 Replies)
Discussion started by: frustrated1
6 Replies

8. AIX

how to block a user temporarily?

hi to all i'm a newbie on aix. how would i block temporarily a few users in accessing our aix server so that other users may not be affected by th cpu usage...because if all of them accessing our server the CPU utilization goes high... thanks winky (3 Replies)
Discussion started by: winky
3 Replies

9. UNIX for Dummies Questions & Answers

delete or disable the system generated account

I have this unix version 3.0 "UNIX_SV server 4.0 3.0 3425 Pentium II(TM)-ISA/PCI" can i delete or disable the system generated account as "daemon";"uucp";"sys";"adm";"listen";"bin" and if yes how can i do it? Regards (1 Reply)
Discussion started by: sak900354
1 Replies

10. AIX

How to disable cd to other folder for a user

How to disable user for cd to some another folders other than his folders. AIX 5L 5.2 Thanks Dilip. (1 Reply)
Discussion started by: Dilippatel
1 Replies
Login or Register to Ask a Question