A woman who was grabbed in the foyer of her unit block on Sydney's lower north shore was carrying a large saucepan at the time and bashed her attacker across the head, police say.

Police said the woman, 46, was walking home in McMahons Point when she noticed the man following her.

He pounced when she entered the foyer of her unit block on Dumbarton Street about 6.15pm on Wednesday.

The man fled when she lashed out with the saucepan.

A witness chased him, but could not catch him.