Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to make my terminal freeze, if it is not used for more than 15 minutes. I do have the option to edit the .ssh/sshd_config.

But I want a script instead of this..

share|improve this question
    
Could you specify freeze a bit more? You want it to behave like a screensaver? Or logout/exit? And why not use the sshd_config? –  ahilsend Jul 30 '13 at 7:34
    
@ahilsend: If a terminal is idle for 15 min, and after that if I try to access that terminal, it shouldn't be accessible unless you do something else like entering a password or entering a new key combination etc. –  peepeep Jul 30 '13 at 9:16
add comment

2 Answers

up vote 3 down vote accepted

See this question for possible solutions.

If you use screen you can press Ctrl-a x to manually lock your session. Your user password is required to unlock it again. For an automatic locking after 15 minutes (900 seconds) just specify idle 900 lockscreen in your .screenrc.

There is also vlock which doesn't require an already running screen session but has to be run manually.

share|improve this answer
    
Setting time in screenrc will be locking the entire system right. I just want to lock the terminal session. –  peepeep Jul 30 '13 at 8:37
    
No, it won't lock the entire system. Just your screen session(s). –  scai Jul 30 '13 at 8:58
    
Thanks for the reply. Its not just about the screen sessions. I want lock any of the terminal which is idle for more than 15 minutes. Is there any options for that? –  peepeep Jul 30 '13 at 9:15
    
1  
I think this will do.. Thank you very much for the help :) –  peepeep Jul 30 '13 at 17:46
show 8 more comments

Add the following lines in user's .bashrc

if [ -z "$STY" ]; then
    exec screen -ARR
fi

Edit the file .screenrc

idle 900 lockscreen

It will lock the screen which is idle for more than 15 minutes and if you try to access it again, you will have to enter the password.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.