LinuxCommandLibrary

chfn

Change user information (finger command)

TLDR

Update a user's "Name" field in the output of finger

$ chfn [[-f|--full-name]] [new_display_name] [username]
copy

Update a user's "Office Room Number" field for the output of finger
$ chfn [[-o|--office]] [new_office_room_number] [username]
copy

Update a user's "Office Phone Number" field for the output of finger
$ chfn [[-p|--office-phone]] [new_office_telephone_number] [username]
copy

Update a user's "Home Phone Number" field for the output of finger
$ chfn [[-h|--home-phone]] [new_home_telephone_number] [username]
copy

SYNOPSIS

chfn [options] [LOGIN]

PARAMETERS

-f, --full-name FULL_NAME
    set full name in GECOS

-h, --home-phone HOME_PHONE
    set home phone in GECOS

-r, --room ROOM_NUMBER
    set room/office number in GECOS

-w, --work-phone WORK_PHONE
    set work phone in GECOS

-s, --shell SHELL
    set login shell (/etc/shells)

--help
    show help message

-V, --version
    show version info

DESCRIPTION

chfn ('change finger') updates the GECOS field and login shell in /etc/passwd. The GECOS field stores user details like full name, room/office number, work phone, home phone, and miscellaneous info, separated by commas.

This data appears in outputs from finger(1) and some login screens. Users can change their own info; root can modify any user's.

Without arguments, chfn runs interactively, prompting for each field sequentially. Specify options to set individual fields non-interactively.

In shadow password systems (common on Linux), chfn safely edits files via libraries, preventing corruption. It's part of shadow-utils, ensuring secure updates without direct manual edits.

Primarily for admin tasks or user self-maintenance, but prefer usermod(8) for scripts due to more options.

CAVEATS

Requires root or self privileges; invalid shell locks login; direct /etc/passwd edits risky—use vipw(1) instead.

INTERACTIVE MODE

Run chfn without args to prompt: full name, room, work phone, home phone, other info.

EXAMPLES

chfn -f 'John Doe' # self
sudo chfn user -r 123 -w 456 # root for user

HISTORY

Part of shadow-utils suite (1990s), from Unix shadow passwords for secure /etc/shadow separation; integrated in util-linux/shadow on Linux.

SEE ALSO

chsh(1), passwd(1), finger(1), usermod(8), vipw(1)

Copied to clipboard