Quote:
Originally Posted by stevea
No - that doesn't work. sshd directly calls logwtmp which creates the record in /var/log/[wu]tmp. These records are supposed to be recorded for ALL session creation. Session creation should create a login record and there is no legitimate reason to avoid it, tho' lots of illegitimate reasons.
|
Not by my tests:
Code:
[jesse@panther ~]$ who
jesse tty1 2010-03-29 11:41 (:0)
jesse pts/0 2010-04-15 17:10 (:0.0)
jesse pts/1 2010-05-12 07:50 (:0.0)
[jesse@panther ~]$ ssh panther who
jesse@panther's password:
jesse tty1 2010-03-29 11:41 (:0)
jesse pts/0 2010-04-15 17:10 (:0.0)
jesse pts/1 2010-05-12 07:50 (:0.0)
[jesse@panther ~]$
Observe that the "who" command executed by the ssh has no tty assigned, and no session shown.
Yet, if I assign a terminal using the "-t" option I get:
Code:
jesse@panther ~]$ ssh -t panther who
jesse@panther's password:
jesse tty1 2010-03-29 11:41 (:0)
jesse pts/0 2010-04-15 17:10 (:0.0)
jesse pts/1 2010-05-12 07:50 (:0.0)
jesse pts/2 2010-05-12 07:55 (panther)
Connection to panther closed.
Therefore, using a remote command (with no terminal/psudoterminal)
assigned does not show a login via the basic who command.
As noted by others, it IS recorded in security logs.
I have had this issue come up before - it was very desirable to observe
a particular user. What was odd was that he logged out every time an
administrator logged in. We didn't worry about it (he was an authorized
user) until another site complained about connections from that specific
machine. So we investigated... Using ssh in this manner allowed us to
observe activity not being recorded by standard audit logs.
Part of the reason this works this way is due to the way who determines
if a record exists - I believe it is in the /var/log/wtmp (though it may be
utmp) if the tty entry is null, "who" assumes it is a terminated record - and
thus not to be shown as an "active" user. The record is not removed
because the file is also used by the BSD accounting systems, which will
generate usage accounting for the session. But in this session, the tty
entry may appear multiple times, with multiple different user values, as
well as with null entries.
This is why cron doesn't show up - no controlling terminal is assigned and
entered, though BSD accounting records can be generated from other
data (/var/log/pacct). This other data also records all processes that
are/have been active in the system if the accounting subsystem has been
activated.