Thursday, May 28, 2009

New features for usermod and useradd in 11iv3

I discovered that HP-UX 11iv3 has a few new options bundled into useradd and usermod , options that I was anticipating for quite some time.

The first one is -p which lets you specify an encrypted password directly on the command-line, without having to modify /etc/shadow directly. That one will be very useful to me as I've scripted the creation of all our generic accounts, such as the WBEM account, and I have to lock and modify the passwd and shadow files before touching them... yuck.

Example:
# useradd -p 7Q4UTWb5U7dCA hpwbem

The second one is -F which, when used with usermod, lets you force changes even though the login is in use. For instance, one can finally use usermod with the root account, without having to modify the passwd or shadow files directly (which is dangerous with /etc/shadow since there is no vipw equivalent that lets you edit shadow files with proper locking).

# usermod -F -p 7Q4UTWb5U7dCA hpwbem

No comments: