Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • Specifically interactive shell sessions? Or do you mean "processes"? Commented Jun 23, 2016 at 6:44
  • 1
    It's not entirely reliable, but since PIDs are generally assigned in ascending order, you could look for the lowest shell PID and kill everything other than it owned by the user in question. Commented Jun 23, 2016 at 6:46
  • @DopeGhoti "Not entirely reliable"?! With PID wrap-around this is terrible advice, especially on a multi-user machine. Also, although the OP states "Linux", as a general solution, this would definitely not work on e.g. OpenBSD (random PIDs). Commented Jun 23, 2016 at 6:51
  • 1
    @Kusalananda Ok I need to do this as I am having an application that consume licenses for users. So multiple logins for the same user would consume more licenses and I need to allow 1 session per user only so that only one could be logged in by same username. Commented Jun 23, 2016 at 7:28
  • 1
    Just logging in causes a license to be used in this application. Commented Jun 23, 2016 at 9:02