2

I've bricked by RaspberryPi by installing a script into /etc/profile.d/

Apparently adding init=/bin/sh to cmdline.txt has not stopped the /etc/prpfile.d/ script from running. Is there a way to modify a config file from Windows to stop the /etc/profile.d/ script from running?

0

you may get another SD card and USB SD card reader, then you may put a fresh image on your new card, put the old one in the USB reader, and modify the old one from the familiar linux environment.

0

Two suggestions:

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
                fi
        done
        unset i
fi

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 /etc/profile.d:

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.