home | list info | list archive | date index | thread index

[OCLUG-Tech] Rescuing user from his own stupidity

Well, this was more a disconnect between eye and brain than a finger fumble, but it was an accident all the same. I have locked myself out of a critical user directory. One does not need to be root, nor enter an obscure equivalent to rm -rf, in order to create mayhem. :-(


BACKGROUND
My youngest son and I share a large music collection. I maintain everything "classical" (so-called) and music from non-Western cultures. He maintains everything else written after 1900 (jazz and so-called "popular" music).

On my main Linux-only desktop (Kubuntu 8.04 KDE4 remix), the music is on a separate physical disk formatted as ext3 (/media/stor); the top level of the music collection is: /media/stor/music. There is a symbolic link to it: /home/bruce/music

One of the backups (and the sneaker-net container) is an external hard disk connected via USB. Although my current main desktop is Linux only, I still have two dual-boot machines (shame!) and my son uses a MacBook. For the sake of convenience, therefore, the backup partition is formatted as FAT32.

It makes me impatient that whenever I copy something from the FAT32 drive, the files come with the executable bits set and display in a Linux directory as green, thereby undermining the ingenious "colourization" of *ix file listings.

I recently set up the following alias to overcome this problem. It identifies all regular files on the path (but not directories) and changes the permissions to 0640:

alias permsvfat2linux='find . -perm -0770 -not -type d -exec chmod 0640 \{\} \;cd'

My stupidity last night was to run this alias inadvertently from ~/ rather than from ~/music.


PROBLEM
I am now locked out from both ~/music/ and /media/stor/music. A verbose file listing (ls -l) brings up a list of "Permission denied" errors followed by the file list of /media/stor/music/ preceded by a sea of question marks ("?").

>From my regular user account, I am able to access other "top-level" directories on /media/stor without incident (e.g. /media/stor/distro-isos where I keep downloaded Linux .iso images). The "music" directory was the only one symlinked from my home directory. A check with "sudo" shows that the entire >90GB of music is safe and sound, merely inaccessible to the primary unprivileged user. :-( Thus it appears that the problem is that the "find" command followed the symbolic link and altered a permission that I have not yet found.

In terms of preventing a repetition of the accident, I use "alias" as much for mnemonics as for shortcuts but have added to this one an opening command to "cd /media/stor/music". It will be a small price to have to re-type the command on those rare occasions that I might want to perform the task on another directory tree.

Any help on resolving this one would be much appreciated. I will treat it as a learning opportunity.
 
--
Bruce Miller
Ottawa ON, Canada
bruce [ at ] brmiller [ dot ] ca
(613) 745-1151
This message is from a webmail login and not from my regular mail system. It does not have my customary digital signature.