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?
There is
top
'ssecure mode
, when it is invoked asIn that mode the user can't change the refresh delay of top,
kill
orrenice
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: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
.