וְאַתָּ֣ה יְ֭הוָה מָגֵ֣ן בַּעֲדִ֑י כְּ֝בוֹדִ֗י וּמֵרִ֥ים רֹאשִֽׁי׃
אָבער דו גאָט ביסט אַ שילד פֿאַר מיר, מײַן כּבֿוד און דער דערהײבער פֿון מײַן קאָפּ.
Rashi
made a hedge around him You protected him like a wall, as in (Isa. 5:5) “I will remove its hedge (משוכתו),” its wall. Every expression of בעד stated in the Hebrew language is only an expression of “opposite and before him,” as in (Lev.16:6), “and he shall effect atonement for himself (וכפר בעדו),” he shall wipe away the sin from opposite you and before you (sic), so that the atonement shall be a shield about you. Similarly (Ps. 3:4), “[But You,] O Lord, are a shield about me (בעדי) .”
Rashi
ויסגור ה' בעדו AND THE LORD SHUT HIM IN — He protected him so that they could not smash up the Ark (cf. 5:13): He surrounded the Ark (thus enclosing it סגר) with bears and lions which killed some of them (Genesis Rabbah 32:8). But the literal meaning of the text is: He shut the door in front of him against the waters. Similarly, wherever בעד occurs in the Scriptures it means כנגד in front of. E. g., (20:18) “The lord had made a closure in front of (בעד) every womb”; (2 Kings 4:4) “Close the door in front of thyself (בעדך) and in front of (ובעד) thy sons”; (Job 2:4) ‘‘skin in front of (as a protection for) (בעד) skin”; (Psalms 3:4) “a shield in front of me ובעדי”: (1 Samuel 12:19) “Pray (בעד) thy servants” which means כנגד in front of (i. e. on behalf of, as a protection for) thy servants.