On Wed, Mar 22, 2000 at 11:33:04AM +0100, Neil D. Roberts wrote: > Thanks Tim ! :) > > So this line changes the root password ? Ok, the password has a nice > length, > with upper and lower case, numbers and a couple simbols. Pretty solid ? > Anyway, so > what does "perl -npi.bak -e 's/^root:[^:]*:/root:pants/o' /etc/shadow" > actually > do, does it create a file, or is it this which appears in the cron ? Sorry > for the > questions, I´m not quite iniciated in perl yet. So, if this does create a > file, > what would I find in, say, cron.daily ? Thanks a lot for this information.
The script edits /etc/shadow, and sets the root's password hash to "pants". (the password hash is the encrypted password, which is computed by a one way function on the password you type (and some "salt", so the hash is different for different users even if they have the same password.)). Notice that /etc/shadow contains encrypted password for every user, or a * or ! to say they can't log in. When you type your password, it is run through the one-way function, which is compared to the hash stored in the file. That way, the info needed to log in is not stored on disk anywhere. ... I read some later mail, and saw that you'd figured it out. A suggestion, though: You should have tested the script on a test file, like ./myshadow, before letting it loose on the system /etc/shadow, to make sure it worked the way you expeded before giving it the chance to do any damage. It's always good to play safe with stuff that'll force you to reboot and hack your way back in (which is actually trivial unless you've taken steps to lock things down) if you screw it up. I still want to know why the root password is getting accidentally changed every now and then! That sounds _really_ bad!! Shouldn't you be finding out why it's changing? Or do your cat sometimes fall across your keyboard in such a way that it sets a new password for you? -- #define X(x,y) x##y DUPS Secretary ; http://is2.dal.ca/~dups/ Peter Cordes ; e-mail: X([EMAIL PROTECTED] , dal.ca) "The gods confound the man who first found out how to distinguish the hours! Confound him, too, who in this place set up a sundial, to cut and hack my day so wretchedly into small pieces!" -- Plautus, 200 BCE