Web Hosting Talk







View Full Version : re-set password with crontab?


nand
07-31-2004, 09:16 PM
I want to re-set password (to the default one - DEMO) of some account every hour - using bash/linux on root. It would be easy but passwd login requires inteaction. How to make in automaticly happen?

one more thing. Is there a way to EMPTY directory with the shell commands? (I dont want to delete it and create, because of chown problems latter).

eth00
07-31-2004, 10:16 PM
I cannot say exactly how to do it but the easy way will probably be to edit the /etc/passwd file and replace the entry with the good line.

BMurtagh
07-31-2004, 10:55 PM
you wouldn't be able to directly edit /etc/passwd because the passwords in there are shadowed. i'm sure there would be a way, but i'm busy at the moment that i cannot look it up. i'll see what i can do when i have time.

Jim_UK
07-31-2004, 11:04 PM
Originally posted by nand
I want to re-set password (to the default one - DEMO) of some account every hour - using bash/linux on root. It would be easy but passwd login requires inteaction. How to make in automaticly happen?


echo -n DEMO | passwd --stdin username

Alter the bits in bold to the (1) required password and (2) the user to alter.


Originally posted by nand
one more thing. Is there a way to EMPTY directory with the shell commands? (I dont want to delete it and create, because of chown problems latter).

How about something like (be careful with this): rm -fR /path/to/dir/*