Saturday, July 16, 2011

AIX user administration - passwd

Many think the passwd command only changes a user's password. Although passwd does perform this important function, it contains other features, as well.
The most important function of passwd is indeed changing a user's password. By following the rules set forth in the configuration files /etc/security/user and /etc/security/passwd, a standard user can change his or her own password or, if logged in as the root user, can change other users' passwords, as Listing shows.

Listing Using passwd to change a user's password

# lsuser -c -a password xander

# passwd xander
Changing password for "xander"
xander's New password:
Enter the new password again:

# lsuser -c -a password xander

The passwd command can also change a user's GECOS information like chfn or his or her shell/command to execute during the login process, like chsh. Listing provides an example.

Listing Using passwd to change a user's information

# passwd -f xander
 xander's current gecos:
                "Xander Cormany,317.555.1234"
 Change (yes) or (no)? > yes
 To?>Xander Cormany,317.555.7890

# passwd -s xander
 Current available shells:
 xander's current login shell:
 Change (yes) or (no)? > yes

# finger xander
Login name: xander                    In real life: Xander Cormany
Site Info: 317.555.7890
Directory: /home/xander                 Shell: /usr/bin/bsh
No Plan.

No comments:

Post a Comment