Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a few servers with an application for some clients, and I want to make an application available for the client to view the server and application status, and to be able to restart some services.

I already have done the major part of it, replacing the login shell of a ssh user with a custom shell script that presents him a menu with some options to do that. The menu is launched automatically with sudo (with NOPASSWD) once he logs in, because the script needs to restart system services. The problem is that I'd like him to view the output of top or htop, but I don't want him being able to kill or renice processes and maybe other things that both top and htop permits. I just want him viewing the output of top.

Is there any option, flag or equivalent command?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

There is top's secure mode, when it is invoked as

top -s

In that mode the user can't change the refresh delay of top, kill or renice processes.

If you want to make it system wide instead of on a per-invocation basis, you may use the /etc/toprc file with the following contents:

s
3.0

Only two lines: first one to set secure-mode, and the second to set the refreshing delay. You can have a ~/.toprc, but its syntax is different from the system-wide /etc/toprc and you can't set secure mode in there.

I can't find a similar option in htop.

share|improve this answer
add comment

Your Answer

 
discard

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.