I recently switched from CentOS7 to Ubuntu 18.04. I used to be able to pkill -u user and it would kill all my processes. However, when I try to do the same in Ubuntu, my SSH session remains active. Using XRDP, I have a similar issue. If I try using "pkill -u user", my XRDP session is terminated and, as root I can see the following process:

user  20848     1  0 09:33 ?        00:00:00 /usr/bin/ssh-agent -s

However, once that process is there, I cannot log back in via XRDP, and I get a few errors upon login. My only fix is to pkill -u user as root. Once I do that, I am able to use XRDP again.

Regardless, I cannot see that process as "user" using ps but I can kill it if I know the process PID.


  • So your question is why ssh-agent is getting orphaned? – steeldriver Mar 1 at 19:14
  • My immediate question is how can I kill all of my processes without having to sudo or switch to root? If I "pkill -u user" as root, it actually kills all the processes of that user but if do the same as that user, it does not (namely, if I have an ongoing XRDP session, that ssh-agent process will remain running, for instance). Why is the ssh-agent process orphaned after "pkill -u user", and is there a way to avoid/fix this, is my other question. – xSoldier Mar 1 at 19:54

From man pkill,

   -f, --full
          The pattern is normally only matched against the process name.  When -f is set, the
          full command line is used.

So pgrep --full "/usr/bin/ssh-agent -s" should show you the PID (then ps -fp$(pgrep --full "/usr/bin/ssh-agent -s") for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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