InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more

Menu
  • Home
  • Sitemap

Python Programming Language Best Tutorials and Code Examples

Learn Python Right Now!
Home
Bash
Disconnecting Inactive Sessions in bash
Bash

Disconnecting Inactive Sessions in bash

InfinityCoder April 3, 2017

You’d like to be able to automatically log out inactive users, especially root.

Set the $TMOUT environment variable in /etc/bashrc or ~/.bashrc to the number of seconds of inactivity before ending the session.

In interactive mode, once a prompt is issued, if the user does not enter a command in $TMOUT seconds, bash will exit.

$TMOUT is also used in the read built-in and the select command in scripts.
Don’t forget to set this as a read-only variable in a system-level file such as /etc/profile or /etc/bashrc to which users have no write access if you don’t want them to be able to change it.

1
2
3
4
declare -r TMOUT=3600
 
# Or:
readonly TMOUT=3600

 

Share
Tweet
Email
Prev Article
Next Article

Related Articles

Reversing the Words on Each Line in bash
You want to print the input lines with words in …

Reversing the Words on Each Line in bash

Leaking Passwords into the Process List in bash
ps may show passwords entered on the command line in …

Leaking Passwords into the Process List in bash

About The Author

InfinityCoder
InfinityCoder

Leave a Reply

Cancel reply

Recent Tutorials InfinityQuest

  • Adding New Features to bash Using Loadable Built-ins in bash
    Adding New Features to bash Using Loadable …
    June 27, 2017 0
  • Getting to the Bottom of Things in bash
    Getting to the Bottom of Things in …
    June 27, 2017 0

Recent Comments

  • fer on Turning a Dictionary into XML in Python
  • mahesh on Turning a Dictionary into XML in Python

Categories

  • Bash
  • PHP
  • Python
  • Uncategorized

InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more

About Us

Start learning your desired programming language with InfinityQuest.com.

On our website you can access any tutorial that you want with video and code examples.

We are very happy and honored that InfinityQuest.com has been listed as a recommended learning website for students.

Popular Tags

binary data python CIDR convert string into datetime python create xml from dict python dictionary into xml python how to create xml with dict in Python how to write binary data in Python IP Address read binary data python tutorial string as date object python string to datetime python

Archives

  • June 2017
  • April 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
Copyright © 2021 InfinityQuest - Programming Code Tutorials and Examples with Python, C++, Java, PHP, C#, JavaScript, Swift and more
Programming Tutorials | Sitemap