1748252 Members
4017 Online
108760 Solutions
New Discussion юеВ

Installing top

 
Bengt Nilsson_2
Regular Advisor

Installing top

I tried to install the latest "top", top3.8, on my 5.1B-4.
Two issues:
I had to
# chmod a+r /dev/mem
# chmod a+r /dev/kmem
and
# chmod u+s /usr/local/bin/top
to make it work for normal users.

Is this safe?
Or are there any alternatives?



2 REPLIES 2
Steven Schweda
Honored Contributor

Re: Installing top

> I tried to install the latest "top",
> top3.8, on my 5.1B-4.

Really? Where did you find it? The latest
I could find said that it was "Top version
3.8beta1".

What, exactly, does "tried to install" mean?

> I had to [...] and [...]

I doubt it. Around here, using "Top version
3.7", "chmod u+s /usr/local/bin/top" seems to
be enough. Changing the permissions on those
/dev/*mem files sounds unwise to me.

With:

urtx# ls -l /dev/*mem
cr--r----- 1 root mem 2, 1 Jan 27 2006 /dev/kmem
cr--r----- 1 root mem 2, 0 Jan 27 2006 /dev/mem

you could do somethings like:
chgrp mem /usr/local/bin/top
chmod g+s /usr/local/bin/top
to get around these permission problems, but
if you expect to get the process info, then
those won't be enough, but "chmod u+s"
(alone) should be enough.

Around here, README says:

On some systems, top requires read access to the memory files
"/dev/kmem" and "/dev/mem" as well as the system's kernel image. Most
installations have these files protected from general access. These
sites would have to install this program in the same way that programs
such as "ps" are installed. On most systems with a /proc file system,
top will try to read everything it can from /proc, but may need extra
permissions to do so. The configure script will determine the
permissions needed by the top binary, and a "make install" as root
will get the binary installed correctly. Sometimes this requires that
the binary be installed with set-group-id privileges and, in rare
cases, set-user-id to root.

Well, around here:

urtx# ls -l /sbin/ps
-rws--x--x 1 root bin 123360 Dec 5 2006 /sbin/ps


The "configure" script may not correctly
"determine the permissions needed by the top
binary", but the other guidance provided by
README seems to be pretty good.
Bengt Nilsson_2
Regular Advisor

Re: Installing top

You are right, it was top3.8beta1, sorry about that.

"Tried" ment that it did not build and run right away, I had to tweak the build a little bit. Make install worked, of course.
As a user, I got permission error on /dev/kmem and /dev/mem, so I opened the read permission to all.
Then it ran but no processes were shown, only the header part.
So I chmod s+u /usr/local/bin/top as adviced in the docs.
But I forgot to try without the open read permissions at this stage, thanks for pointing this out.

I set the permissions back to original and it still runs as it should.

Thanks.