LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-30-2004, 05:07 AM   #1
AshleyK
Member
 
Registered: Sep 2003
Location: Northants, UK
Distribution: RedHat 8, Damn Small
Posts: 39

Rep: Reputation: 15
Question How do I automatically logout after a period of inactivity?


After a few years of being the only person using my RH8 & Gnome based workstation, I am now sharing it. I have gotten into the habit of not logging out (relying on the screen saver or simply locking the machine when I leave it.) Now I am sharing it and frustrating my partner who cannot logon to do her thing when I'm logged on :-(

Does anyone know of a utility or method by which I can have the machine logout of my account and back to the logon prompt after a period of inactivity preferably without pausing to tell me that certain windows do not support 'save setup'? Ideally I'd like the period of inactivity to be longer than that for the screen saver.

TIA
Ashley
 
Old 12-30-2004, 06:42 AM   #2
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
hi there

have a look at my project site

masand.sourceforge.net

i am currently on a project whcih deals something lke this

regards
 
Old 12-30-2004, 06:51 AM   #3
xxx_anuj_xxx
Member
 
Registered: Jun 2004
Location: Bharat
Distribution: RedHat, Debian, FreeBSD, Fedora, Centos
Posts: 114

Rep: Reputation: 16
Talking automatically logout from the shell

"For automatically logout from the shell after a period of inactivity".
To do that, you must set the special variable of Linux named "TMOUT" to the time in seconds.
Edit your profile file "vi /etc/profile" and add the following line somewhere after the line that read
"HISTFILESIZE="
TMOUT=3600
The value we enter for the variable "TMOUT=" is in second and represent 1 hours (60 * 60 =
3600 seconds). If you put this line in your "/etc/profile" file, then the automatic logout after one hour of inactivity will apply for all users on the system. You can set this variable in user's individual ".bashrc " file to automatically logout them after a certain time.
After this parameter has been set on your system, you must logout and login again (as root) for the change to take effect.


There are few kool options also available if you want to make ur room partner feel like a hell.....

logout file

$HOME/.bash_logout
user-specific instruction file, found in each user's home directory. Upon exit from a login (Bash) shell, the commands in this file execute.
"think what command you want to give lol.


cheers
 
Old 12-31-2004, 05:06 AM   #4
AshleyK
Member
 
Registered: Sep 2003
Location: Northants, UK
Distribution: RedHat 8, Damn Small
Posts: 39

Original Poster
Rep: Reputation: 15
Thanks, I tried your suggestion and entered following into /etc/profile:

HISTSIZE=1000
TMOUT=1800

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC TMOUT

Note, I added TMOUT to the export line as well. I've logged on and off as root and back again as my normal user nad it does not auto logout. Do I need to reboot?

Regards
Ashley
 
Old 12-31-2004, 10:47 PM   #5
xxx_anuj_xxx
Member
 
Registered: Jun 2004
Location: Bharat
Distribution: RedHat, Debian, FreeBSD, Fedora, Centos
Posts: 114

Rep: Reputation: 16
Greetings and happy new year to you and everyone else!

Edit your $HOME/.bashrc file
it looks like:-

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

_________________________


now:-


# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
TMOUT=100

#this will cause ur shell to automatically logout after an inactivity of 100 seconds,
________________________________________

HISTSIZE
Bash's history saves several hundred of your most recent commands in a file, by default called .bash_history. You can change the size of this by setting HISTSIZE to whatever you need.


Logout or reboot ur machine, it will work!

cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Logout after inactivity from KDE jst1 Linux - Newbie 2 02-23-2005 01:28 AM
Automatic Logout after inactivity from KDE Suse 9.2 jst1 SUSE / openSUSE 0 02-21-2005 02:05 PM
running a command after a set period of keyboard inactivity? Nocterro Linux - Software 3 09-03-2004 09:04 AM
Webpages/Email takes ages to load after period of inactivity Robstro Linux - Networking 1 05-26-2004 01:31 AM
Log entry during period of inactivity Gavin Linux - General 1 01-14-2002 01:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration