Thursday, February 5, 2009

The who(1) Command Produces No Output

Issue

There is no output from who(1) when run by a non-root user.

When run by the root user, the who(1) command returns the expected output.

Solution

The execution of the who(1) command was traced using tusc as follows:

$ tusc -f -o /tmp/who.out who

The tusc output showed ERR#13 EACCES indicating a permissions issue when opening /etc/utmpss .


open("/etc/utmps", O_RDWR|O_CREAT, 0644) ............................................ ERR#13 EACCES
open("/etc/utmps", O_RDONLY, 01300) ................................................. = 6
read(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".., 648) .................................. = 648
socket(AF_UNIX, SOCK_STREAM, 0) ..................................................... = 7
connect(7, 0x7fffd930, 94) ......................................... ERR#13 EACCES

The issue was resolved by changing the /etc/utmps mode to 644 :

# chmod 644 /etc/utmps