{"id":2163,"date":"2013-07-07T11:35:11","date_gmt":"2013-07-07T03:35:11","guid":{"rendered":"http:\/\/rmohan.com\/?p=2163"},"modified":"2013-07-07T11:36:09","modified_gmt":"2013-07-07T03:36:09","slug":"automatic-users-logout-after-a-period-of-inactivity","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2163","title":{"rendered":"Automatic Users Logout After a Period of Inactivity"},"content":{"rendered":"<p><strong>* For SH\/BASH\/TCSH<\/strong><\/p>\n<p>Below script will implement a 5 minute idle time-out for the default \/bin\/bash\u00a0shell.<\/p>\n<div><strong>Step 1: Create file autologut.sh<\/strong><\/div>\n<p># vi \/etc\/profile.d\/autologout.sh<\/p>\n<h2><a class=\"add-new-h2\" href=\"http:\/\/rmohan.com\/wp-admin\/post-new.php\">Add New<\/a><\/h2>\n<p>Append the following code:<\/p>\n<p>TMOUT=300<\/p>\n<p>readonly TMOUT<\/p>\n<p>export TMOUT<\/p>\n<p><strong>Step 2: Save and close the file. Set permissions:<\/strong><\/p>\n<p># chmod +x \/etc\/profile.d\/autologout.sh<\/p>\n<p>&nbsp;<\/p>\n<p><strong>*For tcsh version follow the below process<\/strong><\/p>\n<p><strong>Step 1: Create file autologut.sh<\/strong><\/p>\n<p># vi \/etc\/profile.d\/autologout.csh<br \/>\nAppend the following code:<\/p>\n<p>set -r autologout 5<\/p>\n<p><strong>Step 2: Save and close the file. Set permissions:<\/strong><\/p>\n<p># chmod +x \/etc\/profile.d\/autologout.csh<\/p>\n<p>&nbsp;<\/p>\n<p><strong>For SSH user inactive interval we can define that in configuration file of the ssh server<\/strong><\/p>\n<p><strong>Step 1 : Configure \/etc\/ssh\/sshd_config file<\/strong><\/p>\n<p># vi \/etc\/ssh\/sshd config<\/p>\n<p>Find ClientAliveInterval and set to 300 (5 minutes) as follows:<\/p>\n<p>ClientAliveInterval 300<\/p>\n<p>ClientAliveCountMax 0<\/p>\n<p><strong>Step 2: Save and close the file. Restart sshd:<\/strong><br \/>\n# service sshd restart<\/p>\n","protected":false},"excerpt":{"rendered":"<p>* For SH\/BASH\/TCSH<\/p>\n<p>Below script will implement a 5 minute idle time-out for the default \/bin\/bash shell.<\/p>\n<p> Step 1: Create file autologut.sh <\/p>\n<p># vi \/etc\/profile.d\/autologout.sh<\/p>\n<p> Add New <\/p>\n<p>Append the following code:<\/p>\n<p>TMOUT=300<\/p>\n<p>readonly TMOUT<\/p>\n<p>export TMOUT<\/p>\n<p>Step 2: Save and close the file. Set permissions:<\/p>\n<p># chmod +x \/etc\/profile.d\/autologout.sh<\/p>\n<p>&nbsp;<\/p>\n<p>*For tcsh version follow the [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2163"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2163"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2163\/revisions"}],"predecessor-version":[{"id":2164,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2163\/revisions\/2164"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}