linux chfn 命令介绍和使用案例
Linux 中的 chfn 命令用于更改用户的指纹信息(finger information),主要用于修改用户账户的全名、工作电话号码、房间号码和家庭电话号码等信息
语法bashchfn [选项] [登录名]常用选项-f full_name:更改账户的全名。-w work_ph:更改工作电话号码。-r room_no:更改房间号码。-h home_ph:更改家庭电话号码。-o other:更改其他信息。命令:
root@meng:~# which chfn
/usr/bin/chfn
root@meng:~# chfn -
chfn: user '-' does not exist
root@meng:~# chfn -h
chfn: option requires an argument -- 'h'
Usage: chfn [options] [LOGIN]
Options:
-f, --full-name FULL_NAME change user's full name
-h, --home-phone HOME_PHONE change user's home phone number
-o, --other OTHER_INFO change user's other GECOS information
-r, --room ROOM_NUMBER change user's room number
-R, --root CHROOT_DIR directory to chroot into
-u, --help display this help message and exit
-w, --work-phone WORK_PHONE change user's office phone number
--extrausers Use the extra users database
命令案例:
root@meng:~# chage -l meng
Last password change : May 29, 2023
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
root@meng:~# chfn meng
Changing the user information for meng
Enter the new value, or press ENTER for the default
Full Name [meng]: mengsy
Room Number []: 120
Work Phone []: 120
Home Phone []: 120
Other []: 120
root@meng:~# chage -l meng
Last password change : May 29, 2023
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
root@meng:~# chfn meng
Changing the user information for meng
Enter the new value, or press ENTER for the default
Full Name [mengsy]:
Room Number [120]:
Work Phone [120]:
Home Phone [120]:
Other [120]:
root@meng:~#