Log file & root password

Hi1. How would you truncate a log file that is growing too large if you don't havespace to compress it or to move it somewhere else? How would you do it?2. If you have forgotten the root password for a server, how do you get back in?Thanks in Advance
[286 byte] By [bsnl-nib] at [2007-11-26 10:29:30]
# 1

1) In most cases, /tmp should still have space left. it's a virtual FS. For all I care, do a "tail -1000 $file > /tmp/baka" and move /tmp/baka over the original file :) I dunno... Just guessing here. There should be a nicer way, like using VI in command mode from the CLI. Telling it to "dd" the first X lines, followed by a ":wq" :)

2) Boot from CD/DVD, manually mount /, kill the password in /etc/shadow

Cailin_Coilleach at 2007-7-7 2:35:19 > top of Java-index,General,Sys Admin Best Practices...
# 2
Thanks Cailin
bsnlnib at 2007-7-7 2:35:19 > top of Java-index,General,Sys Admin Best Practices...
# 3
HiCan anybody give me the detailed answer for below question 1. How would you truncate a log file that is growing too large if you don't havespace to compress it or to move it somewhere else? How would you do it?Thanks in Advance
bsnlnib at 2007-7-7 2:35:19 > top of Java-index,General,Sys Admin Best Practices...
# 4
tail -1000 logile >/tmp/fredcat /tmp/fred > logfile.
robertcohen at 2007-7-7 2:35:19 > top of Java-index,General,Sys Admin Best Practices...