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
#name:password
xander:*

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

# lsuser -c -a password xander
#name: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:
                /bin/sh
                /bin/bsh
                /bin/csh
                /bin/ksh
                /bin/tsh
                /bin/ksh93
                /usr/bin/sh
                /usr/bin/bsh
                /usr/bin/csh
                /usr/bin/ksh
                /usr/bin/tsh
                /usr/bin/ksh93
                /usr/bin/rksh
                /usr/bin/rksh93
                /usr/sbin/uucp/uucico
                /usr/sbin/sliplogin
                /usr/sbin/snappd
 xander's current login shell:
                /usr/bin/ksh
 Change (yes) or (no)? > yes
 To?>/usr/bin/bsh

# 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