1) Files in
/etc/profile.d are sourced from the
/etc/profile script; this is the final block in mine from raspbian:
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
I doubt it is sourced from more than one place, so if you comment out that block (or just the
. $i line in the middle), it won't be read.
The reason using
sh instead of
bash didn't change anything is that
sh is also suppose to read
/etc/profile at login (see here).
2) Probably simpler and more foolproof: just rename
mv /etc/profile.d /etc/profile.d-MOVED
Although I guess if you could do this, you could just remove the offending file. Note sure under what circumstances you will have read access to "modify a config file" but not (re)move one -- but good luck.