-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
rhel-7-els
-
None
-
Low
-
rhel-se-cs-infra-services
-
3
-
False
-
False
-
-
None
-
None
-
None
-
None
-
Unspecified
-
Unspecified
-
Unspecified
-
None
What were you trying to do that didn't work?
On RHEL 7 systems with a TMOUT policy defined via /etc/profile.d/tmout.sh, sourcing /etc/bashrc may trigger a readonly variable warning:
/etc/profile.d/tmout.sh: line 1: TMOUT: readonly variable
Observed during SSH invocation:
ssh root@<host> ". /etc/bashrc" -q
The TMOUT policy is defined as:
# /etc/profile.d/tmout.sh export TMOUT=900 readonly TMOUT
Behavior indicates that the script is executed more than once within the same shell lifecycle. Since TMOUT is already marked readonly, subsequent assignments fail.
Later RHEL releases include double-sourcing protection inside /etc/bashrc (for example BASHRCSOURCED guard), which prevents this condition. RHEL 7 lacks equivalent logic.
Steps to Reproduce
1. Configure TMOUT policy:
cat /etc/profile.d/tmout.sh export TMOUT=900 readonly TMOUT
2. Start SSH session that explicitly sources bashrc:
ssh root@<host> ". /etc/bashrc"
Observe warning:
TMOUT: readonly variable
Expected Result
Shell initialization should not attempt to reassign readonly variables during repeated sourcing paths.
Actual Result
Readonly variable warning appears when initialization scripts are executed multiple times.
Impact
Cosmetic warning. No functional impact. TMOUT enforcement remains correct.