Custom Search

finger command in Ubuntu

Linux finger command prints user information in the system. You need to install finger package in order to use finger command because it's not installed by default. The finger command can be a threat to system security because attacker can gain information about the system. You can turn off the finger daemon or do not install it in the first place.




Why are we going to install it now? We need to know how the finger command works and see how it can danger our system. You can install finger using apt-get command as always:




luzar@ubuntu:~$ sudo apt-get install finger
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer
required:
libdns32 libisc32Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed: finger
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 18.0kB of archives.
After this operation, 77.8kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com hardy/main finger 0.17-11 [18.0kB]
Fetched 18.0kB in 0s (18.8kB/s)
Selecting previously deselected package finger.
(Reading database ... 18970 files and directories currently installed.)
Unpacking finger (from .../finger_0.17-11_i386.deb) ...
Setting up finger (0.17-11) ...
luzar@ubuntu:~$



Here is some information about finger command in manual page:





NAME

finger - user information lookup program

SYNOPSIS

finger [-lmsp] [user ...] [user@host ...]

DESCRIPTION

The finger displays information about the system users.



The finger command is a user information lookup program. What information can we see? We can check that later. The syntax can be as simple as finger user to look for local system and finger user@host for looking into remote system. That's powerful isn't it?




Let's see some finger command examples. Here is an example of finger command without any option or argument specified:




luzar@ubuntu:~$ finger
Login Name Tty Idle Login Time Office Office Phone
luzar luzar pts/0 Nov 22 03:01 (192.168.1.6)
root root *tty1 29 Nov 22 03:00luzar@ubuntu:~$



If no arguments are specified, finger will print an entry for each user currently logged into the system.




Let's say I want to check some information on user name james. I would write the command as:




luzar@ubuntu:~$ finger james
Login: james Name: James Labu
Directory: /home/james Shell: /bin/bash
Office: 133, 012345678 Home Phone: 098765432
On since Sat Nov 22 03:38 (EST) on tty2 15 seconds idle
(messages off)No mail.No Plan.
luzar@ubuntu:~$



I can also use -s to prints in different layout:




luzar@ubuntu:~$ finger -s james
Login Name Tty Idle Login Time Office Office Phone
james James Labu *tty2 17 Nov 22 03:38 133 012345678
luzar@ubuntu:~$



Everything we need to know about user information is there, login name, real name, home directory, shell used, office room and phone numbers, etc.




Now let's see another example with useful options. This time it's how to finger remote host. Use the format as in the example below:




luzar@ubuntu:~$ finger james@ubuntu



If you want to remove finger command from Ubuntu system, use the command in example below:




luzar@ubuntu:~$ sudo apt-get remove finger
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer
required: libdns32 libisc32Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED: finger
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 77.8kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 19000 files and directories currently installed.)
Removing finger ...
luzar@ubuntu:~$ sudo apt-get update



You can run apt-get update after that. Now test finger command again to if it's still running in our system.




luzar@ubuntu:~$ finger
-bash: /usr/bin/finger: No such file or directory
luzar@ubuntu:~$



That's it, no more finger daemon running.

No comments:

Post a Comment

Please keep comment relevant and strictly no spam will be tolerated. Thank you.