# Locking the console

## HMC

A few problems:

I currently have TMOUT="90" in ~/.bashrc which works fine in console and KDE Konsole to log-out of the root account after 90s.

1. I would like to be able to do this for ALL users globally (/etc/env.d/99local ??). It'll work fine for the linux console, but doesn't play nice with Konsole (it is killed) when normal users are logged into DE. I don't need it in Konsole for normal users anyway. I want the log-out for normal users on the console only. Any suggestions on how to achieve this.... environment variables specifying tty's?

2. Next issue is one of locking the console. The above works fine for auto log-out, but a big issue is that the console is held open until the running process is complete. ie When there is a pile of updates (especially if OO is in there) or processing a huge file for inclusion in a DB (from a user account) that might take a day or two to complete a console is held open for the entire period. Vlock will lock the console ($ vlock -c) which is fine, but how can this be configured as an auto lock? Is it even capable of this? Man page mentions environment variables, but I get nowhere.

The desired behaviour is lock after 60s regardless of what is happening and logout 90s after the last command completes.

Thanks

----------

## Anarcho

 *HMC wrote:*   

> A few problems:
> 
> I currently have TMOUT="90" in ~/.bashrc which works fine in console and KDE Konsole to log-out of the root account after 90s.
> 
> 1. I would like to be able to do this for ALL users globally (/etc/env.d/99local ??). It'll work fine for the linux console, but doesn't play nice with Konsole (it is killed) when normal users are logged into DE. I don't need it in Konsole for normal users anyway. I want the log-out for normal users on the console only. Any suggestions on how to achieve this.... environment variables specifying tty's?

 

Check ENV seems reasonable. Why don't you try?

 *HMC wrote:*   

> 2. Next issue is one of locking the console. The above works fine for auto log-out, but a big issue is that the console is held open until the running process is complete. ie When there is a pile of updates (especially if OO is in there) or processing a huge file for inclusion in a DB (from a user account) that might take a day or two to complete a console is held open for the entire period. Vlock will lock the console ($ vlock -c) which is fine, but how can this be configured as an auto lock? Is it even capable of this? Man page mentions environment variables, but I get nowhere.
> 
> The desired behaviour is lock after 60s regardless of what is happening and logout 90s after the last command completes.

 

You can start the long running process in a screen (emerge screen) session. After you've send the sceen to the background (CRTL-A D) you can logoff. After you have login you can go back to the screen session which is hopefully done.

----------

## HMC

First bit - Not sure (read no idea) how. TMOUT ttys and how to apply that to users...

CRTL-A D does nothing on my system. Ctrl-Z, jobs fg and bg are available, but it is not what I am trying to achieve.

The running process will terminate if I exit.

----------

## Anarcho

You have to start screen first. After you have detached the screen (the application screen) you can logoff. Later, after login again, you can use "screen -xr" to resume with your screen session.

----------

## HMC

Okay, thanks. I should have read what was written a bit better. I have been playing with it a little. I get where you are going now, but preference would be to achieve an auto lock.

----------

## Hu

 *HMC wrote:*   

> First bit - Not sure (read no idea) how. TMOUT ttys and how to apply that to users...

 When you are in script context and preparing to set TMOUT, you can read and write other environment variables as well.  As far as I know, the only time that $TERM is set to the value linux is when logged in on a real terminal, not a pty under xterm/Konsole.  Therefore, you could write:

```

if [ "$TERM" = 'linux' ]; then

  TMOUT=90

fi
```

----------

