Attack and king safety
Meet a pawn storm by closing the file
To stop a pawn storm, compare what each reply leaves on the threatened file. Passing the attacking pawn can keep the file closed where a capture opens it to the rook.
Worked example
Position in text
Black to move. White: pawn g5, pawn h4, king c1, rook h1. Black: king g8, pawn f7, pawn g7, pawn h6.
FEN: 6k1/5pp1/7p/6P1/7P/8/8/2K4R b - - 0 1
After 1...hxg5 2.hxg5 both h-pawns have moved away and the h1-rook sees up the open file. After 1...h5, the pawns on h4 and h5 block each other; the rook does not get through. If Black ignores g5 with 1...Kf8, White can play 2.gxh6 and the g7-pawn can answer 2...gxh6, replacing the pawn on the file. Evaluate the replacement shield as well as the first capture.
A plausible mistake
“Capture the nearest attacking pawn” often cooperates with the attack. But passing is not an automatic defense either: inspect any other capture into your shield, including en passant when a pawn actually moves two squares.
Try it yourself
Position in text
Black to move. White: pawn g5, pawn h4, king c1, rook h1. Black: king g8, pawn f7, pawn h6.
FEN: 6k1/5p2/7p/6P1/7P/8/8/2K4R b - - 0 1
Remove Black’s g7-pawn. Compare 1...h5 with 1...Kf8 2.gxh6. Which keeps the h-file shut right away?
Check your answer
1...h5 keeps both h-pawns locked. After the king move and 2.gxh6, the white pawn on h6 remains on the file but the defender has lost its h-pawn and can no longer replace it with ...gxh6. The rook still needs the white pawns to move, so the file has not opened immediately.