<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Linux / UNIX Automatically Log BASH / TCSH / SSH Users Out After a Period of Inactivity</title> <atom:link href="http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Some Guy</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-65442</link> <dc:creator>Some Guy</dc:creator> <pubDate>Sat, 10 Dec 2011 15:19:07 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-65442</guid> <description>ClientAliveInterval 300
ClientAliveCountMax 0
This keeps sessions alive by sending nul packets every 300 seconds. It doesn&#039;t disconnect idle users.</description> <content:encoded><![CDATA[<p>ClientAliveInterval 300<br
/> ClientAliveCountMax 0</p><p>This keeps sessions alive by sending nul packets every 300 seconds. It doesn&#8217;t disconnect idle users.</p> ]]></content:encoded> </item> <item><title>By: Dougie Smythe</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-60208</link> <dc:creator>Dougie Smythe</dc:creator> <pubDate>Fri, 24 Jun 2011 12:00:31 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-60208</guid> <description>Thanks so much for the tcsh syntax, Indie.
I&#039;ll give it a try.</description> <content:encoded><![CDATA[<p>Thanks so much for the tcsh syntax, Indie.<br
/> I&#8217;ll give it a try.</p> ]]></content:encoded> </item> <item><title>By: Indie</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-60157</link> <dc:creator>Indie</dc:creator> <pubDate>Tue, 21 Jun 2011 14:09:49 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-60157</guid> <description>TCSH uses the autologout variable instead of TMOUT so you&#039;d need to create autologout.csh with something like the following, I&#039;m not at all familiar with TCSH syntax.
&lt;pre&gt;
switch (`id -un`)
case root:
case sysadmin:
case backup:
unset autologout
breaksw
default:
set -r autologout=100
endsw
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>TCSH uses the autologout variable instead of TMOUT so you&#8217;d need to create autologout.csh with something like the following, I&#8217;m not at all familiar with TCSH syntax.</p><pre>
switch (`id -un`)
  case root:
  case sysadmin:
  case backup:
    unset autologout
    breaksw
  default:
    set -r autologout=100
endsw
</pre>]]></content:encoded> </item> <item><title>By: Dougie Smythe</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-60149</link> <dc:creator>Dougie Smythe</dc:creator> <pubDate>Tue, 21 Jun 2011 11:02:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-60149</guid> <description>Thanks Indie, that was what I was looking for. But I have both bash and tcsh users on my system. So how do I implement it in csh?
Cheers,
ds</description> <content:encoded><![CDATA[<p>Thanks Indie, that was what I was looking for. But I have both bash and tcsh users on my system. So how do I implement it in csh?<br
/> Cheers,</p><p>ds</p> ]]></content:encoded> </item> <item><title>By: Indie</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-59525</link> <dc:creator>Indie</dc:creator> <pubDate>Fri, 20 May 2011 00:17:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-59525</guid> <description>@MikeM: You can kill specific terminals with the command
&lt;pre&gt;pkill -HUP -t pts/2&lt;/pre&gt;
you don&#039;t need to send it the kill signal.
You could also modify the original autologout.sh script so the TMOUT value only gets set for specific users
&lt;pre&gt;case &quot;$(id -un)&quot; in
root&#124;sysadmin&#124;backup) ;;
*)    readonly TMOUT; export TMOUT=300;;
esac&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>@MikeM: You can kill specific terminals with the command</p><pre>pkill -HUP -t pts/2</pre><p>you don&#8217;t need to send it the kill signal.</p><p>You could also modify the original autologout.sh script so the TMOUT value only gets set for specific users</p><pre>case "$(id -un)" in
  root|sysadmin|backup) ;;
  *)    readonly TMOUT; export TMOUT=300;;
esac</pre>]]></content:encoded> </item> <item><title>By: Matteo D'Alfonso</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-48282</link> <dc:creator>Matteo D'Alfonso</dc:creator> <pubDate>Thu, 08 Jul 2010 08:53:59 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-48282</guid> <description>Thanks!
Only one note, on tcsh v. 6.14 you need to quote the value:
set -r autologout=&#039;5&#039;</description> <content:encoded><![CDATA[<p>Thanks!</p><p>Only one note, on tcsh v. 6.14 you need to quote the value:</p><p>set -r autologout=&#8217;5&#8242;</p> ]]></content:encoded> </item> <item><title>By: Vivek Gite</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40992</link> <dc:creator>Vivek Gite</dc:creator> <pubDate>Tue, 31 Mar 2009 20:15:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40992</guid> <description>@MikeM
Thanks for sharing your script.</description> <content:encoded><![CDATA[<p>@MikeM</p><p>Thanks for sharing your script.</p> ]]></content:encoded> </item> <item><title>By: MikeM</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40990</link> <dc:creator>MikeM</dc:creator> <pubDate>Tue, 31 Mar 2009 16:55:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40990</guid> <description>We wanted something a bit more user explicit (log out idle users but not the boss(s)). The list of users below are exempt. Set this script in crontab to run every 10 minutes. With an idle of time of 30, the idled sessions will be no more than 39 minutes idle.
Here is our script;
&lt;pre&gt;
#! /usr/bin/awk -f
BEGIN {
system(&quot;who -u &#124; sort +5 &gt; /tmp/loginfile&quot;);
system(&quot;echo User Sessions Killed &gt; /tmp/killedlogins&quot;);
system(&quot;echo `date` &gt;&gt; /tmp/killedlogins&quot;);
while (getline = 1) &#124;&#124; (timearray[2] &gt;= 30)) &amp;&amp;
($1 != &quot;root&quot;) &amp;&amp;
($1 != &quot;user2&quot;) &amp;&amp;
($1 != &quot;user2&quot;) &amp;&amp;
($1 != &quot;user4&quot;) &amp;&amp;
($1 != &quot;lastuser&quot;)) { {
system(&quot;ps -ef &#124; grep &quot; $1 &quot; &#124; awk &#039;{print $2}&#039; &#124; xargs kill -KILL&quot;);
print $1, &quot;[Idle &quot; $6 &quot;] Session terminated from &quot; $8 &gt;&gt; &quot;/tmp/killedlogins&quot;;
};
};
};
}&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>We wanted something a bit more user explicit (log out idle users but not the boss(s)). The list of users below are exempt. Set this script in crontab to run every 10 minutes. With an idle of time of 30, the idled sessions will be no more than 39 minutes idle.<br
/> Here is our script;</p><pre>
#! /usr/bin/awk -f
BEGIN {
system("who -u | sort +5 &gt; /tmp/loginfile");
system("echo User Sessions Killed &gt; /tmp/killedlogins");
system("echo `date` &gt;&gt; /tmp/killedlogins");
while (getline = 1) || (timearray[2] &gt;= 30)) &amp;&amp;
($1 != "root") &amp;&amp;
($1 != "user2") &amp;&amp;
($1 != "user2") &amp;&amp;
($1 != "user4") &amp;&amp;
($1 != "lastuser")) { {
system("ps -ef | grep " $1 " | awk '{print $2}' | xargs kill -KILL");
print $1, "[Idle " $6 "] Session terminated from " $8 &gt;&gt; "/tmp/killedlogins";
};
};
};
}</pre>]]></content:encoded> </item> <item><title>By: Boopalan</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40633</link> <dc:creator>Boopalan</dc:creator> <pubDate>Sat, 07 Mar 2009 02:49:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40633</guid> <description>i wont hardware networking /linux /ccna</description> <content:encoded><![CDATA[<p>i wont hardware networking /linux /ccna</p> ]]></content:encoded> </item> <item><title>By: marz</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40483</link> <dc:creator>marz</dc:creator> <pubDate>Wed, 25 Feb 2009 21:23:33 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40483</guid> <description>while date ; do sleep 10 ; done
or
watch -n 10 date
;)</description> <content:encoded><![CDATA[<p>while date ; do sleep 10 ; done</p><p>or</p><p>watch -n 10 date</p><p>;)</p> ]]></content:encoded> </item> <item><title>By: Liju</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40481</link> <dc:creator>Liju</dc:creator> <pubDate>Wed, 25 Feb 2009 15:19:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40481</guid> <description>Good tips .. :-)</description> <content:encoded><![CDATA[<p>Good tips .. :-)</p> ]]></content:encoded> </item> <item><title>By: yoander</title><link>http://www.cyberciti.biz/faq/linux-unix-login-bash-shell-force-time-outs/#comment-40480</link> <dc:creator>yoander</dc:creator> <pubDate>Wed, 25 Feb 2009 14:58:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=3379#comment-40480</guid> <description>nice tip</description> <content:encoded><![CDATA[<p>nice tip</p> ]]></content:encoded> </item> </channel> </rss>
