chfn Command

Purpose

Changes a user's gecos information.

Syntax

chfn [ -R load_module ] [ Name ]

Description

The chfn command changes a user's gecos information. Gecos information is general information stored in the /etc/passwd file. This information is not used by the system. The type of information you store in this field is up to you. Some system administrators store information such as the user's full name, phone number, and office number.

The chfn command is interactive. After you enter the command, the system displays the current gecos information and prompts you to change it. To exit the chfn command without changing any information, press Enter.

You can use any printable characters in the gecos information string except a : (colon), which is an attribute delimiter.

By default, the chfn command changes the gecos information of the user who runs the command. You can also use this command to change the gecos information of other users. However, you must have execute permission for the chuser command to change the gecos information for another user.

For users that were created using an alternate Identification and Authentication mechanism (I&A) , the -R flag can be used to specify the I&A load module used to create the user. Load modules are defined in the /usr/lib/security/methods.cfg file.

Flag

Item Description
-R Specifies the loadable I&A module used to change the user's gecos information

Security

Access Control

All users should have execute (x) access to this command since the program enforces its own access policy. This command should be installed as a program in the trusted computing base (TCB). The command should be owned by the security group with the setgid (SGID) bit set.

Files Accessed

Mode File
x /usr/bin/chuser
rw /etc/passwd

Attention RBAC users and Trusted AIX® users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Limitations

Changing a user's gecos information may not be supported by all loadable I&A modules. If the loadable I&A module does not change a user's gecos information, an error is reported.

Examples

  1. If you are John Smith and want to change your gecos information, type:
    chfn 
    The current gecos string appears, followed by a prompt that asks if a change should be made:
    current gecos:
         "John Smith;555-1746;room 74"
    change (y/n)? >  
    To change the room number from 74 to 36, type y to request a change and type the revised information when the to? > prompt appears:
    current gecos:
         "John Smith;555-1746;room 74"
    change (y/n)? > y
    to? > John Smith;555-1746;room 36 
  2. If you are John Smith and want to view your gecos information but not change it, type:
    chfn 
    The current gecos string appears, followed by a prompt that asks if a change should be made:
    current gecos:
         "John Smith;555-1746;room 74"
    change (y/n)? >  
    If you decide not to change the information, type n after the change (y/n)? prompt or press the Enter key:
    current gecos:
         "John Smith;555-1746;room 74"
    change (y/n)? > n
    This is your opportunity to indicate that the information should remain unchanged. If you enter y, you are committed to enter an information string or use the Enter key to set the string to null. Note that the function of the Enter key differs before and after a y character is entered.
  3. If you have execute (x) permission for the chuser command and want to change the gecos information for the johns user, type:
    chfn johns 
    The current gecos string and prompts appear as in Example 1.
  4. To change the gecos for an LDAP I&A load module defined user davis, type:
    chfn -R LDAP davis

Files

Item Description
/usr/bin/chfn Specifies the path to the chfn command.
/usr/bin/chuser Changes user information.
/etc/passwd Contains basic user attributes.