Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 1995 10:50:10 -0600 (MDT)
From:      mbarkah@teton.Mines.Colorado.EDU (Ade Barkah)
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-hackers@FreeBSD.org, ports@FreeBSD.org
Subject:   Re: lsof 3.25 now available for fbsd 2.0
Message-ID:  <9504061650.AA42466@teton.Mines.Colorado.EDU>

next in thread | raw e-mail | index | archive | help
J Wunsch wrote:

>> ... The version uploaded was compiled with -DHASSECURITY which 
>> restricts non-priviledged users from listing other people's open 
>> files. ...
>
> Does this make sense?  I'm perfectly able to look at any open file
> with fstat(1).  So why restrict lsof to less than fstat can do?

Well, lsof is capable in displaying much more than fstat by default, 
to the point that other user's privacy might be invaded, so I decided 
to restrict the output.

`lsof' uses the kernel name cache to get the file name associated with 
an open descriptor (if any). fstat, on the other hand, limits itself 
to the mountpoint of the file unless you specifically give the file 
name as an argument.

For example, here are two lines from fstat about me and my vi editor:

| mbarkah  vi         10325    3 /usr2      3920 -rw-rw-r--       0  r
| mbarkah  vi         10325    5 /tmp          4 -rw-------       0 rw

However, here are the corresponding output from `lsof':

| vi        10325  mbarkah    3rW VREG     4,  13          0   3920 /usr2 --
| m/mbarkah/verypersonalfile
|
| vi        10325  mbarkah    4u  VREG     4,   0          0   7834 / --
| var/tmp/vi.recover/vi.010325

Notice that lsof actually shows which file I'm editing, whereas fstat
has no such information.

Another example.... here's what fstat shows about my working directory:

| mbarkah  csh        10126   wd /usr      92285 drwxrwxr-x     512  r

`lsof' goes further than displaying only the /usr mountpoint:

| csh       10126  mbarkah  cwd   VDIR     4,  12        512  92285 /usr --
| src/sys

and it shows my working directory to be /usr/src/sys.

Without the HASSECURITY option, any user on the system can too easily
spy on another user, watching exactly what processes he is running and
which files he is working on, his current directory, network connections,
etc., and I'm not sure this is what most people want. However, I'd
be happy to replace the current version with a lenient version if
the net so desires.

Since lsof is setgid, people should compile their own anyhow, rather
than trusting (the possibly evil) me. =)

Regards,

-Ade Barkah



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9504061650.AA42466>