Em 13-01-2014 20:20, Bruce Dubbs escreveu:
> After a little bit of reading and experimenting, I now think that lsof
> should be in /bin but without the suid bit set. I don't get a message
> about /dev/kmem, but do get a lot of lines with 'Permission Denied' as a
> regular user. That's probably for the best.
>
> lsof could be useful to an admin without /usr mounted,
That what I understood in the first suggestion you made. I asked later,
just to be sure.
> and also useful
> for a programmer as a regular user. That user would have to filter the
> 'Permission Denied', but that's probably as it should be.
>
> The documentation still recommend suid for linux, but that may be a very
> old recommendation.
I tend more to agree with the documentation and your initial suggestion.
Having said that, I accept that the majority seems to prefer /usr/bin/,
no suid, and have not strong reason or feeling about it to do differently.
Thank you very much for all your help, Bruce.
Some experimenting I have doen, in the following.
For a process run by unprivileged user, no complaints, eg, lsof -c vim.
But for a process run by root, I need to run it as root, because as
unprivileged user, it does complain, as you say:
{{{
fernando [ ~ ]$ lsof -c init
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd unknown /proc/1/cwd
(readlink: Permission denied)
init 1 root rtd unknown /proc/1/root
(readlink: Permission denied)
init 1 root txt unknown /proc/1/exe
(readlink: Permission denied)
init 1 root NOFD /proc/1/fd
(opendir: Permission denied)
}}}
{{{
fernando [ ~ ]$ sudo lsof -c init
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system
/home/fernando/.gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd DIR 8,19 4096 2 /
init 1 root rtd DIR 8,19 4096 2 /
init 1 root txt REG 8,19 32288 262272 /sbin/init
init 1 root mem REG 8,19 1870456 786915 /lib/libc-2.14.1.so
init 1 root mem REG 8,19 153440 786893 /lib/ld-2.14.1.so
init 1 root 10u FIFO 0,5 0t0 9646 /dev/initctl
}}}
In a terminal where I first used when it was installed at /usr/sbin/,
when tried using again, after installing now in /usr/bin, it complained
that there was no /usr/sbin/lsof/, weird.
However, when I searched in the internet, the examples all seemed to be
given as root.
It does not bother me, having to switch to root for some processes, but
it wouldn't bother if I had always to use it as root.
--
[]s,
Fernando
--
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page