<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: control login in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128888#M31329</link>
    <description>&lt;!--!*#--&gt;You must consider that if you don't handle this  carefully, the user may "forget" that was already logged in and try a second session, killing all its jobs. That is not good.&lt;BR /&gt;&lt;BR /&gt;You will need a script like this in the profile:&lt;BR /&gt;&lt;BR /&gt;SESCOUNT=`who -a | grep $USER | wc -l`&lt;BR /&gt;if [ $SESCOUNT -gt 1 ]&lt;BR /&gt;then&lt;BR /&gt;  THISTTY=`tty | sed "s/\/dev\///"`&lt;BR /&gt;  OLDSHELL=`ps -u $USER | grep -v $THISTTY | awk {'print $1}'`&lt;BR /&gt;  kill -9 $OLDSHELL&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;What it does is to check all "bash" process and kill the process not asociated with the current terminal. If you kill the parent shell, all children processes will die.</description>
    <pubDate>Mon, 14 Jan 2008 16:02:01 GMT</pubDate>
    <dc:creator>Ivan Ferreira</dc:creator>
    <dc:date>2008-01-14T16:02:01Z</dc:date>
    <item>
      <title>control login</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128887#M31328</link>
      <description>I use linux box , in the system , all user are only allowed one login at the same time  , that mean all users can only have one login session in the system at the same time , so sometimes when the user was disconnected by unexpected reason (the reason such as unstable network ) , then the system does not allow the user login again until the pervious login was logged out , so I would like to ask how to do that - when the user login, if it found there is a pervious login session in the system ( or this user's process ) , then logout this login and kill all its process , so that the system release the login to user , then the user can login to the system now , can advise how to do that ? thx in advance.&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jan 2008 15:37:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128887#M31328</guid>
      <dc:creator>elainelaw</dc:creator>
      <dc:date>2008-01-14T15:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: control login</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128888#M31329</link>
      <description>&lt;!--!*#--&gt;You must consider that if you don't handle this  carefully, the user may "forget" that was already logged in and try a second session, killing all its jobs. That is not good.&lt;BR /&gt;&lt;BR /&gt;You will need a script like this in the profile:&lt;BR /&gt;&lt;BR /&gt;SESCOUNT=`who -a | grep $USER | wc -l`&lt;BR /&gt;if [ $SESCOUNT -gt 1 ]&lt;BR /&gt;then&lt;BR /&gt;  THISTTY=`tty | sed "s/\/dev\///"`&lt;BR /&gt;  OLDSHELL=`ps -u $USER | grep -v $THISTTY | awk {'print $1}'`&lt;BR /&gt;  kill -9 $OLDSHELL&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;What it does is to check all "bash" process and kill the process not asociated with the current terminal. If you kill the parent shell, all children processes will die.</description>
      <pubDate>Mon, 14 Jan 2008 16:02:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128888#M31329</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2008-01-14T16:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: control login</title>
      <link>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128889#M31330</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;There is nothing built in to Linux to perform this. You have to use the code that Ivan posted or soemthing else.&lt;BR /&gt;&lt;BR /&gt;/etc/profile is the gate where you can do this kind of conditional access.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 14 Jan 2008 16:25:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/control-login/m-p/4128889#M31330</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2008-01-14T16:25:53Z</dc:date>
    </item>
  </channel>
</rss>

