First taste of HP-UX system administration

by on August 26, 2005 · 13 comments· LAST UPDATED August 26, 2005

in

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:

HP-UX USER ADMIN COMMANDS:
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 sun.com website. New sites looks quite cool and tries to improve corporate image.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 13 comments… read them below or add one }

1 bill August 27, 2005 at 1:37 pm

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.

Regards,
Bill

Reply

2 Gordon September 15, 2005 at 1:37 am

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.

Reply

3 Anonymous December 21, 2005 at 12:55 pm

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

Reply

4 nixcraft December 21, 2005 at 3:47 pm

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

Reply

5 Anonymous September 26, 2006 at 4:58 am

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.

http://docs.hp.com/en/B3921-90010/modprpw.1M.html

Reply

6 Shabi November 16, 2006 at 9:52 am

Hi

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 vvsha1980@gmail.com

Regards
Shabi

Reply

7 nixCraft November 16, 2006 at 1:44 pm

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 ;)

Reply

8 raj July 30, 2007 at 7:44 am

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

Reply

9 Arun June 12, 2008 at 6:29 am

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

Reply

10 Anusha June 7, 2009 at 5:57 am

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

Reply

11 esha July 7, 2009 at 2:29 pm

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

Reply

12 am_7riel January 29, 2010 at 7:15 am

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.

Reply

13 Jav August 5, 2011 at 9:53 am

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

Reply

Leave a Comment

Previous post:

Next post: