LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-28-2006, 11:09 AM   #1
taborekle
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Rep: Reputation: 0
Can you set a screen timeout in character mode


Hi all,

I have to build some Red Hat Enterprise machines for my work, and the default init state will be 3 for these machines most of the time, which should set it up for console (character) login (IE, NOT X11). I'd like to set the console so that if theres no activitiy after a certain period of time, it will screen lock the screen. Is it possible to do this in console mode?

Thanks in advance,

Larry
 
Old 04-28-2006, 12:03 PM   #2
mikeyt_333
Member
 
Registered: Jun 2001
Location: Up in the clouds
Distribution: Fedora et al.
Posts: 353

Rep: Reputation: 30
Yep, edit /etc/profile and add the environment variable TMOUT:

Code:
TMOUT=[number of seconds]

export ... TMOUT
Notice that the export command there includes many other items as well, don't remove the other items, just append the TMOUT variable. The TMOUT variable is described in "man bash" along with many other environment variables you find useful, like HISTSIZE to limit the number of commands in your bash history.

HTH,
Mike.
 
Old 04-28-2006, 12:40 PM   #3
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 34
TMOUT will logout though, surely, not lock the screen.

There are programs that can lock the screen (one called "lock" I believe, but I don't have it). However, I'm not sure if they can be set on a timer.

But, you could easily add a timer to one of these programs by running it in a background process that would lock the screen after a certain period of time, and put a command in $pre_cmd (zsh) or $PROMPT_COMMAND (bash) that would reset the timer, e.g.

lock_screen_timer:

Code:
#!/bin/sh
echo $$ > ~/log/lock_screen.pid
sleep 5m
# lock # insert program to lock screen here
reset_lock_timer:

Code:
#!/bin/sh
kill $(<~/log/lock_screen.pid)
exec lock_screen_timer
and in ~/.bashrc

Code:
PROMPT_COMMAND=~/bin/reset_lock_timer
lock_screen_timer
So if you don't type anything for 5 mins, obviously PROMPT_COMMAND won't run so the screen will lock. A bit ad-hoc but it would do, at least until you find something better.
 
Old 04-28-2006, 12:47 PM   #4
mikeyt_333
Member
 
Registered: Jun 2001
Location: Up in the clouds
Distribution: Fedora et al.
Posts: 353

Rep: Reputation: 30
My mistake, I was thinking log out, sorry bout that.
 
Old 04-28-2006, 01:28 PM   #5
taborekle
LQ Newbie
 
Registered: Dec 2005
Posts: 9

Original Poster
Rep: Reputation: 0
My thanks to both mikeyt 333 and ioerror for their help with this.

Larry
 
  


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
Changing character set won't work tumbelo Linux - Software 1 06-01-2005 07:47 AM
Character set in the terminal intuxicator Debian 1 05-01-2005 02:56 AM
Character Set displayed problem. chrislee8 Linux - Newbie 3 10-02-2004 12:28 PM
How can I change display mode from character mode to graph mode wuzhong Linux - Hardware 1 08-08-2004 09:36 AM
Character Set issues waynediamond Linux - Software 1 07-05-2004 06:26 PM

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

All times are GMT -5. The time now is 11:27 PM.

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