Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Come impostare il timeout di una shell
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 1:59 pm    Post subject: Come impostare il timeout di una shell Reply with quote

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.. :P

grazie see ya
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 2:20 pm    Post subject: Reply with quote

Se la shell che usi è bash, basta impostare la variabile d'ambiente TMOUT:

Ad esempio:

Code:
export TMOUT=60


Permette di fare logout dopo 60 secondi.
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 2:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu Aug 16, 2007 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 2:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 2:37 pm    Post subject: Reply with quote

con export TMOUT nn funzia..mettendolo a mano ne bashrc degli utenti invece funziona..ma non dovro' farmeli tutti a mano? :P
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 2:39 pm    Post subject: Reply with quote

sbranz wrote:
con export TMOUT nn funzia..mettendolo a mano ne bashrc degli utenti invece funziona..ma non dovro' farmeli tutti a mano? :P


Ovvero ???
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 2:41 pm    Post subject: Reply with quote

ovvero se da root mando un export TMOUT=60 la shell non muore dopo 60 sec...
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 2:43 pm    Post subject: Reply with quote

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 :lol: ?
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 2:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 2:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 3:06 pm    Post subject: Reply with quote

ah molto rassicurante...neanche se metto mano a /etc/profile? qualsiasi utente puo metterci mano?
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Thu Aug 16, 2007 3:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
sbranz
n00b
n00b


Joined: 03 Jul 2007
Posts: 69

PostPosted: Thu Aug 16, 2007 3:14 pm    Post subject: Reply with quote

:( ok grazie :P
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum