Technical article 119402

If I run "recon" and enter "who am i" I get wrong information

OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

I am using the "recon" command, which provides another shell. When I type:

# who am i

I get blank or the incorrect information returned.

Cause

"recon" functions as an escape sequence reconglomerator. It gives the invoking user a new pseudo-tty and passes input and output between this pty and the user's original tty.

"recon" gives a tty, but doesn't write an entry to /etc/utmp because it isn't a login shell. Being on a tty that has no utmp record creates a situation in which "who am i" may return empty information.

"who" looks up ttyname in /etc/utmp so after executing "recon" there is a new ttyname that isn't in /etc/utmp, so "who" cannot figure out who you are.

Over time /etc/utmp tends to collect errors, one of the most common one is that it will list ttys that are no longer logged in.

/etc/utmp maintains status for all ttys over time, so it contains records for those where the user has not logged out correctly and this is commonly caused by logins disconnecting ungracefully (eg. turning off a Windows client system).

If the tty you get from `recon` is listed in /etc/utmp from an old
session, `who am i` may display something along the lines of:
$ tty
/dev/ttyp46
$ who am i
<my_server>      ttyp46       Jan  3 11:25
$ recon
$ tty
/dev/ttyp52
$ who am i
   .       ttyp52       Jan  8 11:43

Solution

A workaround would be to use:
# echo "$LOGNAME\t`tty`\t`id`"
root    /dev/ttyp2

Using "who" will list all the ttys that are currently logged in.

# who
root       ttyp1        Jan 10 10:17

ie. will not list the new ttyp2 tty used by the "recon" shell.

See also

id(C)
recon(C)
tty(C)
who(C)

From the Xinuos technical article database, record 119402. Reproduced with permission. The original is at www.sco.com/ta/119402, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.