33

For some reason, I have a few open sessions on an SSH server that I don't know about. I assume they're leftovers from when my pipe broke.

$ users
user1 user2 user3 me me me me

Is there a way to log me out across all sessions?

3 Answers 3

35

You could try killing off the individual processes that are still running as you, or just purge the system of everything running as you: pkill -u username

3
  • 1
    This command kind of restarts the remote machine and all the opened programs get closed. We are only interested in closing the multiple connections.. Commented Feb 18, 2023 at 19:44
  • What if you are logged as root? This is terrible advice
    – Freedo
    Commented Jun 8 at 22:13
  • If this OP has 3 other users logged in as is mucking around as root killing off processes then I think they deserved to get exactly what this will do.
    – Caleb
    Commented Jun 14 at 11:39
15
loginctl terminate-user <Your User Name>

should kill all sessions of your user

1
  • 4
    It worked! All SSH sessions are logged out =)
    – Megidd
    Commented Jul 15, 2021 at 2:11
-2
# ps -ea | grep username

kill -9 id's

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .