{
    "mode": "man",
    "parameter": "chfn",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/chfn/1/json",
    "generated": "2026-06-15T14:25:11Z",
    "synopsis": "chfn [options] [LOGIN]",
    "sections": {
        "NAME": {
            "content": "chfn - change real user name and information\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "chfn [options] [LOGIN]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The chfn command changes user fullname, office room number, office phone number, and home\nphone number information for a user's account. This information is typically printed by\nfinger(1) and similar programs. A normal user may only change the fields for her own account,\nsubject to the restrictions in /etc/login.defs. (The default configuration is to prevent\nusers from changing their fullname.) The superuser may change any field for any account.\nAdditionally, only the superuser may use the -o option to change the undefined portions of\nthe GECOS field.\n\nThese fields must not contain any colons. Except for the other field, they should not contain\nany comma or equal sign. It is also recommended to avoid non-US-ASCII characters, but this is\nonly enforced for the phone numbers. The other field is used to store accounting information\nused by other applications.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options which apply to the chfn command are:\n",
            "subsections": [
                {
                    "name": "-f --full-name",
                    "content": "Change the user's full name.\n",
                    "flag": "-f",
                    "long": "--full-name"
                },
                {
                    "name": "-h --home-phone",
                    "content": "Change the user's home phone number.\n",
                    "flag": "-h",
                    "long": "--home-phone"
                },
                {
                    "name": "-o --other",
                    "content": "Change the user's other GECOS information. This field is used to store accounting\ninformation used by other applications, and can be changed only by a superuser.\n",
                    "flag": "-o",
                    "long": "--other"
                },
                {
                    "name": "-r --room",
                    "content": "Change the user's room number.\n",
                    "flag": "-r",
                    "long": "--room"
                },
                {
                    "name": "-R --root",
                    "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                    "flag": "-R",
                    "long": "--root"
                },
                {
                    "name": "-u --help",
                    "content": "Display help message and exit.\n",
                    "flag": "-u",
                    "long": "--help"
                },
                {
                    "name": "-w --work-phone",
                    "content": "Change the user's office phone number.\n\nIf none of the options are selected, chfn operates in an interactive fashion, prompting the\nuser with the current values for all of the fields. Enter the new value to change the field,\nor leave the line blank to use the current value. The current value is displayed between a\npair of [ ] marks. Without options, chfn prompts for the current user account.\n",
                    "flag": "-w",
                    "long": "--work-phone"
                }
            ]
        },
        "CONFIGURATION": {
            "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
            "subsections": [
                {
                    "name": "CHFN___RESTRICT (string)",
                    "content": "This parameter specifies which values in the gecos field of the /etc/passwd file may be\nchanged by regular users using the chfn program. It can be any combination of letters f,\nr, w, h, for Full name, Room number, Work phone, and Home phone, respectively. For\nbackward compatibility, yes is equivalent to rwh and no is equivalent to frwh. If not\nspecified, only the superuser can make any changes. The most restrictive setting is\nbetter achieved by not installing chfn SUID.\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/login.defs\nShadow password suite configuration.\n\n/etc/passwd\nUser account information.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "chsh(1), login.defs(5), passwd(5).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                      CHFN(1)",
            "subsections": []
        }
    },
    "summary": "chfn - change real user name and information",
    "flags": [
        {
            "flag": "-f",
            "long": "--full-name",
            "arg": null,
            "description": "Change the user's full name."
        },
        {
            "flag": "-h",
            "long": "--home-phone",
            "arg": null,
            "description": "Change the user's home phone number."
        },
        {
            "flag": "-o",
            "long": "--other",
            "arg": null,
            "description": "Change the user's other GECOS information. This field is used to store accounting information used by other applications, and can be changed only by a superuser."
        },
        {
            "flag": "-r",
            "long": "--room",
            "arg": null,
            "description": "Change the user's room number."
        },
        {
            "flag": "-R",
            "long": "--root",
            "arg": null,
            "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
        },
        {
            "flag": "-u",
            "long": "--help",
            "arg": null,
            "description": "Display help message and exit."
        },
        {
            "flag": "-w",
            "long": "--work-phone",
            "arg": null,
            "description": "Change the user's office phone number. If none of the options are selected, chfn operates in an interactive fashion, prompting the user with the current values for all of the fields. Enter the new value to change the field, or leave the line blank to use the current value. The current value is displayed between a pair of [ ] marks. Without options, chfn prompts for the current user account."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "chsh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/chsh/1/json"
        },
        {
            "name": "login.defs",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/login.defs/5/json"
        },
        {
            "name": "passwd",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/5/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Update `finger` info for a user.",
        "examples": [
            {
                "description": "Update a user's \"Name\" field in the output of `finger`",
                "command": "chfn {{-f|--full-name}} {{new_display_name}} {{username}}"
            },
            {
                "description": "Update a user's \"Office Room Number\" field for the output of `finger`",
                "command": "chfn {{-o|--office}} {{new_office_room_number}} {{username}}"
            },
            {
                "description": "Update a user's \"Office Phone Number\" field for the output of `finger`",
                "command": "chfn {{-p|--office-phone}} {{new_office_telephone_number}} {{username}}"
            },
            {
                "description": "Update a user's \"Home Phone Number\" field for the output of `finger`",
                "command": "chfn {{-h|--home-phone}} {{new_home_telephone_number}} {{username}}"
            }
        ]
    }
}