First taste of HP-UX system administration

Recently I had chance to play with HP-UX UNIX on HP hardware. To my surprise most of Linux command do work with HP-UX with some minor changes in syntax :). It has nifty tool called SAM (The System Administration Manager) is a GUI user interface for performing most routing administrative tasks without using command line admin utility. The SAM works under CDE (common desktop environment).

I’m gone administrate at least 3-4 HP-UX box for next couple of weeks before they are going to get new UNIX admin for growing data center. So I will have chance to get my hands on dirty with HP-UX. That means you will see couple of HP-UX related entries in this blog. As soon as these HP-UX box comes in our IDC, I was asked to add user accounts. To be frank I was bit frightened because I never worked on HP-UX. Here is what so far I have learned:

These are almost same as Linux user admin commands, here is quick summery:

Important files:

  • /etc/passwd – User account database file
  • /etc/group – Group database file
  • /etc/profile – System login script
  • ~/.profile – Users own login script
  • ~/.shrc OR ~/.kshrc OR ~/.cshrc – Users own shell startup script (these are executed always whenever users login)
  • /etc/skel/ – Default directory from which all files copied when new users created.

a) useradd – Create a new users

# useradd -m rocky

b) usermod – Modify user account

# usermod -G dbusers rocky

Modify secondary group membership of rocky
c) userdel – Remove user account, -r removes user foo home directory.

# userdel foo
# userdel -r foo

e)groupadd – Create a group

# groupadd dbusers

f) groupmod – Modify a group
Chantge the name of ftpusers to wwwproject

# groupmod -n wwwproject ftpusers

g) groupdel – Delete/remove the account group

# groupdel  wwwproject 

h) grpck – Check for syntax error in /etc/group file

i) pwck – Check for sysntax error in /etc/passwd file

j) passwd – Setup password and manage password restriction
Setup foo’s password

# passwd foo

Remove/delete password/null password

# passwd -d foo

Force to change password at next login

# passwd -f foo

Disable/Lock user account

# passwd -l foo

Unlock HP-UX user account by editing (using vi text editor) /etc/passwd file:

# vi /etc/passwd

Man pages are real help. These system are in our internal network; in coming days at least 2 system will go online for testing purpose so I may need to configure routing and other stuff (right now they are getting IP from our DHCP server).

So far so good. To be frank, I like the HP-UX , no problem to administrate it. May be in coming days I will see more surprises (ill keep my finger crossed).

Between I have noticed Sun had redesigned website. New sites looks quite cool and tries to improve corporate image.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 13 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
13 comments… add one
  • bill Aug 27, 2005 @ 13:37

    Hee HP-UX is always fun. You *reminder* me the old days when I use to work with MC ServiceGuard with HP-UX 🙂 it was fun and boy HP-UX rocks. I hope you will enjoy it too… ALL THE BEST.


  • Gordon Sep 15, 2005 @ 1:37

    Glad to hear you like HP-UX, it’s a great OS and I hope to read more about your work with it.

    Let us know about any snags you run into and maybe we can give you a hand.

  • Anonymous Dec 21, 2005 @ 12:55

    Is there a way to enable a ‘disabled’ HP-UX account thro command line.
    I do not want to use SAM

  • 🐧 nixcraft Dec 21, 2005 @ 15:47

    You use following commands:
    Lock HP-UX user account with the following command:
    passwd -l {username}

    Unlock HP-UX user account by edit (using vi text editor):
    vi /etc/passwd

  • Anonymous Sep 26, 2006 @ 4:58

    You can’t use vi to re-enable an account if you are using password aging or “trusted” password databases, and the user is aged out or locked out due to too many login failures.

    To enable a disabled HP-UX account via the command line, run one of these commands:

    /usr/lbin/modprpw -l -k username

    /usr/lbin/modprpw -l -x username

    The first one re-enables the account; the second one re-enables the account and generates a new random password; -l means you are using a “local” files database. You’d need different options if you are using NIS. Run modprpw with no arguments to see the possibilities (not what they mean, but at least you know what they are).

    I haven’t found documentation for modprpw; I just found these command in my “samlog” after using sam to re-enable accounts.

  • Shabi Nov 16, 2006 @ 9:52


    Can somebody help me on following query.
    How to set life time of user in command line?
    I mean if one username required only to till some date say 23/05/2007, then how will we specify with useradd command when we create a user account

    mail me


  • 🐧 nixCraft Nov 16, 2006 @ 13:44

    Use -e mm/dd/yy

    For example Specifies the date on which user vivek login can no longer be used after Jan-28-07
    useradd -e 1/28/07 vivek

    PS: don’t put your email id in public, you will be spam to death by bots 😉

  • raj Jul 30, 2007 @ 7:44

    its nice that we all share our knowlage
    i want to know 2 things
    1> how we copy data from one physical volume to other physical volume in same volume group.
    2> what is logical partition

  • Arun Jun 12, 2008 @ 6:29

    how to create the users under some directory for Ex : /opt

  • Anusha Jun 7, 2009 @ 5:57

    what is the comand that is used to check the hardware failures?

  • esha Jul 7, 2009 @ 14:29

    Command to check full path for directory that been shortcut : example $ for SUNOS. Anyone?

  • am_7riel Jan 29, 2010 @ 7:15

    hey man,yeah the hp-ux is real simple i mean not as hard as i imagined when i came into unix or linux world.The command is similar but syntax is different. I still like getting to get used with it,since i am now jumping from unix sysadmin to now hp-ux sysadmin and ibm-aix.Hope i can come frequent here to check if any issue arised later or maybe in touch with you personally if i could not find it HP site about it.

  • Jav Aug 5, 2011 @ 9:53

    How do I restrict number of sessions per user on a hp server . User sessions are showing up as “pts/txy”

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum