After an errant script in my .bash_profile created thousands of files on my computer and bogged it down to inoperable speeds I've managed to fix it by booting into single user mode and executing a find | rm combo. The offending script's pseudocode (which may look familiar to a recent post) is:

while(i > 0)
    touch filename$i

While in SU I ran

fsck -fy
mount -uw

to allow for file system changes and deleted the impossible number of files. I have since removed the script from my bash profile as well. Although now my OSX partition runs smoothly, I cannot use my terminal, when launching it the error message:

login: -: Permission denied

[Process completed]

Does anybody have any insight into how I can fix the login permissions?

edit: I've tried using the repair permissions in Disk Utility, but to no avail.


Turns out after editing some stuff in single user mode my terminal was set to open the shell from the root directory. Cant do that, obviously. Changed it to the location of my .bash_profile and everything is working again. Guess I should look for the simple solution before assuming that something deep in the system was changed.

Edit: The fix was made in the preferences section of the Terminal App. I have the shell set to open with the Command (complete path) option. Before the fix the terminal was loading from / but now I have fixed it so that in my case the terminal opens from path ~/.bash_profile. Since my profile doesn't have direct access to / the login script failed with a permission denied message.

Sorry about the unclear answer!

  • Can you elaborate on "set to open the shell from the root directory"? – Chris Page Nov 8 '11 at 8:55

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.