0

htop 3.2.2 running as a regular user only shows I/O rates (IO_RATE/IO_READ_RATE/IO_WRITE_RATE) for some processes and "N/A" for others.

Running as root shows I/O for all processes.

How can I configure htop show I/O rates for all processes while running as a regular user?

1 Answer 1

0

htop tries to read the /proc/pid/io file for each process to get I/O statistics.

Near the end of the /proc/pid/io section of proc(5) we have:

Permission to access this file is governed by a ptrace access mode PTRACE_MODE_READ_FSCREDS check; see ptrace(2).

General ptrace() permissions can be granted with CAP_SYS_PTRACE but we also need CAP_DAC_READ_SEARCH to bypass the file-read permission checks done by the ptrace() access algorithm.

setcap(8) can be used to set both capabilities on the htop executable:

sudo setcap 'cap_sys_ptrace=ep cap_dac_read_search=ep' /usr/bin/htop 

The cap bits can be verified with:

sudo getcap /usr/bin/htop 

...or reset all together:

sudo setcap '' /usr/bin/htop 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.