Using chpasswd to Set User Passwords in AIX

By | February 24, 2015

chpasswdI have had to create a lot of users in AIX environments lately. After users are created, their initial passwords need to be set. The chpasswd command is handy because it can used used for a single password or used in batch. The following description and examples are published at the IBM Knowledge Center:


chpasswd [ -R load_module ] [ -e ] [ -f flags | -c ]


The chpasswd command administers users’ passwords. The root user can supply or change users’ passwords specified through standard input. Each line of input must be of the following format:


Only root users can set passwords with this command.

By default, the chpasswd command sets the ADMCHG flag for the users. The -f option may be used with other valid flags to override the default. The -c option clears all password flags.

The password field can be cleartext or a value encrypted with the crypt algorithm. The -e option indicates that passwords are of encrypted format. Please note that all passwords in a batch must conform to the same format.


-c Clears all password flags
-e Specifies that the passwords are of encrypted format
-f flags  Specifies the comma separated list of password flags to set. Valid flag values are: ADMIN, ADMCHG, and/or NOCHECK
-R load_module  Specifies the loadable I&A module used to change users’ passwords


Only root users should have execute (x) access to this command. The command should have the trusted computing base attribute.


  • To set passwords for users from the command line, type:


Followed by entering username:password pairs, one pair per line. Enter CTRL+D when finished.


  • To set passwords for users contained in a file named mypwdfile, type the following:

cat mypwdfile | chpasswd

Note that mypwdfile must contain username:password pairs; one pair per line. For example:


Leave a Reply

Your email address will not be published. Required fields are marked *