See processes from given user on all machines

521 views Asked by At

On a linux server with different computers: is there a way to see all processes running from a given user on all machines?

1

There are 1 answers

0
whoan On BEST ANSWER

Maybe it's too late for the answer, but for the records...
You can get it in this way:

hosts='192.168.1.x 192.168.1.y' # your hosts here
for host in $hosts; do
    echo $host:
    ssh some_user@$host 'ps -u given_user' # some_user for ssh, given_user for ps
done

In this way, you're creating an ssh session for each host:

ssh ... [user@]hostname [command]

If command is specified, command is executed on the remote host instead of a login shell.

...and executing ps with the -u option:

-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or ID is in userlist.