Linux “who am i” command
Posted by Planet Malaysia on February 27, 2009
Linux “who” command is use to show who is logged on the Linux server.
For an example:
planetmy:~ # who am i
user1 pts/0 Feb 27 08:14 (192.168.1.145)
planetmy:~ # who am i|cut -d! -f2|cut -d\ -f1
Yesterday, one of the Linux box show an empty result with “who am i” or “who” command.
If you look at “man who“,
If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common. If ARG1 ARG2 given, -m presumed: `am i’ or `mom likes’ are usual.
1. Make sure /var/run/utmp exist?
2. Make sure /var/run/utmp update if any user login.
3. Rename existing /var/run/utmp and create an empty /var/run/wtmp with same permission.
Solve your problem?
Probably you may ask why “who am i” and not “whoami“? Try login with normal user and type “sudo su –” and enter “who am i” and “whoami” command and you will notice the differential.
Possibly Related Posts:
- How to add Dell PERC Drivers into VMware Converter Cold Clone ISO
- Top 10 Free Anti Virus
- Microsoft SQL 2008 Agent not starts
- VMware Workstation 7 Serial Key
- WP Contact Form III – You do not have sufficient permissions to access this page Error