‘chfn’ command to change the user finger information in CentOS / Red Hat / Fedora / Ubuntu and Scientific Linux

To change the user finger information , you use ‘ chfn ‘ command .This information is stored in the /etc/passwd file, and this information is displayed by the finger command. The Linux finger command will display four pieces of information that can be changed by  ‘chfn’  your  real name, your work room and phone, and your home phone.

The syntax for chfn command as shown below

 chfn [options] [username]

Before change user finger information:

[intzar@localhost ~]$ finger intzar
Login: intzar                                   Name: M. Faheem
Directory: /home/intzar                 Shell: /bin/bash
On since Fri Apr  1 22:37 (IST) on pts/0 from 192.168.147.1
1 second idle
No mail.
No Plan.
[intzar@localhost ~]$
 

 To change the finger information of login user:

[intzar@localhost ~]$ chfn
Changing finger information for intzar.
Name [M. Faheem ]: Intzar Ahmed
Office []: C-149 Okhla Phase I
Office Phone []: 012204644676
Home Phone []: 01398244899

Password:
Finger information changed.
[intzar@localhost ~]$ 

Now check:

[intzar@localhost ~]$ finger intzar
Login: intzar                           Name: Intzar Ahmed
Directory: /home/intzar                 Shell: /bin/bash
Office: C-149 Okhla Phase I, 012204644676       Home Phone: +0-139-824-4899
On since Fri Apr  1 22:37 (IST) on pts/0 from 192.168.147.1
4 seconds idle
No mail.
No Plan.
[intzar@localhost ~]$

                              Or

[intzar@localhost ~]$ cat /etc/passwd | grep intzar
intzar:x:1000:1000:Intzar Ahmed,C-149 Okhla Phase I,012204644676,01398244899:/home/intzar:/bin/bash
[intzar@localhost ~]$

To change only full name or real name, you use ‘ -f ‘ or ‘ –full-name ‘ option :

[intzar@localhost ~]$ chfn -f “Faheem Ahmed” intzar
Changing finger information for intzar.
Password:
Finger information changed.

[intzar@localhost ~]$

[intzar@localhost ~]$ finger intzar
Login: intzar                           Name: Faheem Ahmed
Directory: /home/intzar                 Shell: /bin/bash
Office: C-149 Okhla Phase I, 012204644676       Home Phone: +0-139-824-4899
On since Fri Apr  1 22:37 (IST) on pts/0 from 192.168.147.1
7 seconds idle
No mail.
No Plan.
[intzar@localhost ~]$

To change only office location ,you use ‘ -o ‘ or ‘ –office ‘ option :

[intzar@localhost ~]$ chfn -o “c-168 Near Kalindikunj” intzar
Changing finger information for intzar.
Password:
Finger information changed.

[intzar@localhost ~]$

 

[intzar@localhost ~]$ finger intzar
Login: intzar                           Name: Faheem Ahmed
Directory: /home/intzar                 Shell: /bin/bash
Office: c-168 Near Kalindikunj          Office Phone: 012204644676
Home Phone: +0-139-824-4899
On since Fri Apr  1 23:17 (IST) on pts/0 from 192.168.147.1
2 seconds idle
No mail.
No Plan.
[intzar@localhost ~]$

To change only office Phone Numer ,you use ‘ -p ‘ or ‘ –office-phone option :

[intzar@localhost ~]$ chfn -p “1234567890” intzar
Changing finger information for intzar.
Password:
Finger information changed.
[intzar@localhost ~]$
[intzar@localhost ~]$ finger intzar
Login: intzar                           Name: Faheem Ahmed
Directory: /home/intzar                 Shell: /bin/bash
Office: c-168 Near Kalindikunj          Office Phone: 123-456-7890
Home Phone: +0-139-824-4899
On since Fri Apr  1 23:17 (IST) on pts/0 from 192.168.147.1
3 seconds idle
No mail.
No Plan.
[intzar@localhost ~]$

To change only home Phone Numer ,you use ‘ -h ‘ or ‘  –home-phone option :

[intzar@localhost ~]$ chfn -h “1234567890” intzar
Changing finger information for intzar.
Password:
Finger information changed.
[intzar@localhost ~]$
[intzar@localhost ~]$ finger intzar
Login: intzar                           Name: Faheem Ahmed
Directory: /home/intzar                 Shell: /bin/bash
Office: c-168 Near Kalindikunj          Office Phone: 123-456-7890
Home Phone: 123-456-7890
On since Fri Apr  1 23:17 (IST) on pts/0 from 192.168.147.1
6 seconds idle
No mail.
No Plan.
[intzar@localhost ~]$

To change information for other user:

Only root can change finger information for other users for ie. i want to change phone no. of user dev1.It will give the Permission denied denied error.

[intzar@localhost ~]$ chfn dev1
chfn: running UID doesn’t match UID of user we’re altering, change denied: Permission denied
[intzar@localhost ~]$

But, as  a root user you can change the finger information of dev1

[intzar@localhost ~]$ su –
Password:
Last login: Fri Apr  1 23:29:34 IST 2016 on pts/0
[root@localhost ~]# chfn dev1
Changing finger information for dev1.
Name []:

 All command line options  used with the ‘chfn’ command are shown below

________________________________________________________________________
Options:                                                 Description

__________________________________________________________________________
-f, –full-name <full-name>           real name
-o, –office <office>                          office number
-p, –office-phone <phone>           office phone number
-h, –home-phone <phone>             home phone number

 -u, –help                                               display this help and exit
-v, –version                                          output version information and exit

___________________________________________________________________________

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s