View previous topic :: View next topic |
Author |
Message |
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 1:59 pm Post subject: Come impostare il timeout di una shell |
|
|
Vorrei fare in modo che una shell staccasse l'utente se è inattivo o ha processi non aperti dopo un tot di minuti..è possibile?
ovviamente parlo di login locale...non un ssh..
grazie see ya |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 2:20 pm Post subject: |
|
|
Se la shell che usi è bash, basta impostare la variabile d'ambiente TMOUT:
Ad esempio:
Permette di fare logout dopo 60 secondi. _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 2:24 pm Post subject: |
|
|
hmm ok...un altra domanda..ma questo vale per tutti gli utenti? è possibile ad esempio fare in modo che tutti tranne un utente e magari il root possano subire questo tipo di timeout? |
|
Back to top |
|
|
Cazzantonio Bodhisattva
Joined: 20 Mar 2004 Posts: 4514 Location: Somewere around the world
|
Posted: Thu Aug 16, 2007 2:27 pm Post subject: |
|
|
A dire il vero sarebbe utile proprio per l'utente root! (per non lasciare inavvertitamente shell di root aperte a giro)
Comunque basta metterlo solo nel bashrc degli utenti che preferisci... Oppure metterlo in /etc/profile e mettere export TMOUT="" nel bashrc degli utenti che non devono andare in timeout _________________ Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 2:33 pm Post subject: |
|
|
sbranz wrote: | hmm ok...un altra domanda..ma questo vale per tutti gli utenti? |
E' una variabile d'ambiente quindi vale solo per le shell in cui è settata.
sbranz wrote: |
è possibile ad esempio fare in modo che tutti tranne un utente e magari il root possano subire questo tipo di timeout? |
Qualcosa del genere in /etc/profile dovrebbe fare al caso tuo:
Code: |
if [[ $USER == "root" || $USER == "tuo_user" ]] ; then
export TMOUT=60
else
:
fi
|
_________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 2:37 pm Post subject: |
|
|
con export TMOUT nn funzia..mettendolo a mano ne bashrc degli utenti invece funziona..ma non dovro' farmeli tutti a mano? |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 2:39 pm Post subject: |
|
|
sbranz wrote: | con export TMOUT nn funzia..mettendolo a mano ne bashrc degli utenti invece funziona..ma non dovro' farmeli tutti a mano? |
Ovvero ??? _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 2:41 pm Post subject: |
|
|
ovvero se da root mando un export TMOUT=60 la shell non muore dopo 60 sec... |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 2:43 pm Post subject: |
|
|
Provato da me e funziona:
Code: |
gutter@giskard ~ $ su -
Password:
giskard ~ # export TMOUT=10
giskard ~ # timed out waiting for input: auto-logout
gutter@giskard ~ $
|
Sei sicuro di aver aspettato un minuto ? _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 2:54 pm Post subject: |
|
|
Si ho aspettato..cmq in ogni caso ora funziona..la cosa che mi fa specie è che.. dato da root export nn vale per tutti..ma la cosa che mi fa rabbrividire è che ogni utenza con un export TMOUT si setta il valore che meglio crede...io voglio invece che sia bloccato dall'admin questo valore..è possibile? |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 2:59 pm Post subject: |
|
|
sbranz wrote: | ma la cosa che mi fa rabbrividire è che ogni utenza con un export TMOUT si setta il valore che meglio crede...io voglio invece che sia bloccato dall'admin questo valore..è possibile? |
No. _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 3:06 pm Post subject: |
|
|
ah molto rassicurante...neanche se metto mano a /etc/profile? qualsiasi utente puo metterci mano? |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Aug 16, 2007 3:07 pm Post subject: |
|
|
sbranz wrote: | ah molto rassicurante...neanche se metto mano a /etc/profile? qualsiasi utente puo metterci mano? |
Qualunque utente può fare un unset della variabile. _________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
sbranz n00b
Joined: 03 Jul 2007 Posts: 69
|
Posted: Thu Aug 16, 2007 3:14 pm Post subject: |
|
|
ok grazie |
|
Back to top |
|
|
|