Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Ubuntu Server 10.04. I have users that normally don't have access to sudo. When this user is using top command he sees only processes for the current user. I added a line to /etc/sudoers:

user ALL = NOPASSWD: /usr/bin/top

But now we have access not only for a list of system processes, but also for killing them, which is not desired.

Is there any other way of doing this?

share|improve this question
up vote 7 down vote accepted

You can allow the user to run only "top -s" this is secure mode and disables the ability to kill stuff.

user ALL = NOPASSWD: /usr/bin/top -s
share|improve this answer

Normally top will display all processes on the system. That your top is not doing so suggests that something has been done to restrict it - there are kernel patches that add this functionality. You need to find out what has been added to your system.

share|improve this answer
bofh ALL=(root) NOPASSWD: /usr/bin/top

works fine for me, i can sudo top only; maybe you have other sudo rules that helps you killing procs as well?

if you're talking about the right to kill a process with top well that's normal; top uses kill() internally to terminate the process requested; once you execute top as root you'll also make the syscalls involved as root user

share|improve this answer
I think the OP knows this and wants to avoid doing so. – Iain Mar 29 '11 at 10:40
yup, i know that you can kill processes from top :) using your command user can still kill processes this way, right? – trylik Mar 29 '11 at 11:38
yep :) I also upvoted fbh – sysfault Mar 29 '11 at 11:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.