This is a guide to secure your iphone 4 if you ever jailbreak it..
Run Cydia and navigate through / Manage/ Sources/ Edit/ select Add
Use cydia search to find and install the current beta Terminal for iOS4 (just search for terminal as only 2 download options appeared on mine and the ios4 compatible terminal is clearly marked)
Hit the home button on your phone and run terminal (note that passwords and commands below are shown with quotes. do NOT enter the quotes as they are solely to identify the relevant required input data)
Type in “su root” and hit RETURN.
Type the root password “alpine” and hit RETURN.
You are now logged in as root. Type “passwd” and hit RETURN.
input a new password (dont do a short simple one) and hit RETURN. You won’t see anything being entered on the terminal screen during password entries so pay attention to what you are typing on the keypad.
the iPhone will now ask you to retype the new password, so type in your newly created password and hit RETURN.
Respring and thats it for the root password.
Dont forget to change your mobile$ password as well while you are here. It is done almost exactly the same as the root apart from one difference.
Run Terminal and you will see it says mobile$ on screen and is waiting for a command.
Type “passwd” and touch RETURN. You will be prompted for the original default mobile “alpine” password here so enter it and hit RETURN
input a new password (for ease of use use the same new password you used for the root password) and hit RETURN. (as before, you won’t see anything during password entries so pay attention to what you are typing on the keypad).
it will now prompt you to retype the new password, so type in your new password and hit RETURN. (Nothing is shown to say it has worked here, the software only gives you a message if your confirmation password entry fails to match the new password just entered
Respring and thats it, Job done and both passwords changed.