chfn is a command-line utility in Linux that is used to change the user information associated with a specific user account. This information includes the user’s full name, office location, office phone number, and other details that are stored in the system password file.
To use chfn, you will need to have root privileges or be the owner of the user account that you want to modify. You can then use the following command syntax to change the user information:
# chfn [options] username
This command will prompt you to enter the new user information, which you can enter by typing or pasting the information at the prompt. When you are finished, you can press Enter to save the changes.
chfn includes several options that allow you to customize the way it modifies the user information. For example, you can use the -f option to specify the full name, the -o option to specify the office location, and the -p option to specify the office phone number.
For example, to change the full name of the user john to John Smith, you can use the following command:
# chfn -f "John Smith" john
chfn Command Examples
1. Update a user’s “Name” field in the output of `finger`:
# chfn -f new_display_name username
2. Update a user’s “Office Room Number” field for the output of `finger`:
# chfn -o new_office_room_number username
3. Update a user’s “Office Phone Number” field for the output of `finger`:
# chfn -p new_office_telephone_number username
4. Update a user’s “Home Phone Number” field for the output of `finger`:
# chfn -h new_home_telephone_number username