On 11/13/2010 09:07 AM, John Haxby wrote:
On 12 November 2010 22:46, Srija <[email protected]
<mailto:[email protected]>> wrote:
I set it as readonly variable so that nobody can change it. The variable
is set in /etc/profile
The problem is, if an user login , as himself , he can't change TMOUT
parameter until he changes the shell. If the user changes the shell , it
can be modified.
I need a solution, to protect the TMOUT parameter not to be modified .
To the best of my knowledge it's not possible. A variable is passed
from one process to another (a child process) as an environment variable
but there is no way to mark parts of the environment read only.
You could try setting TMOUT in /etc/bashrc (or whatever it's called, I
forget), but that will only ensure that it's set when a new bash shell
is started. You won't stop someone who is determined.
jch
You can declare readonly variables bash using the following:
[u...@somehost ~]$ TMOUT=900
[u...@somehost ~]$ readonly TMOUT
[u...@somehost ~]$ export TMOUT
or
[u...@somehost ~]$ declare -rx TMOUT=900
Then trying to change the value of TMOUT gives the following:
[u...@somehost ~]$ export TMOUT=150
-bash: TMOUT: readonly variable
For system-wide effect, it would be advisable to set the above in a file
in /etc/profile.d/ such as /etc/profile.d/auto_logout.sh. Note, that
this would only apply to Bourne-compatible shells, so you'd also need to
do something similar if you have any csh users.
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list