We investigate dynamo action for a parallel flow of an electrically conducting fluid located over a boundary with spatially varying magnetic permeability. We first compute the dynamo threshold numerically. Then we perform an asymptotic expansion in the limit of small permeability modulation, which gives accurate results even for moderate modulation. We present in detail the mechanism at work for this dynamo. It is an interplay between shear (an $\omega $-effect) and a new conversion mechanism that originates from the non-uniform magnetic boundary. We illustrate how a similar mechanism leads to dynamo action in the case of spatially modulated electrical conductivity, a problem studied by Busse & Wicht (Geophys. Astrophys. Fluid Dyn., vol. 64, 1992, pp. 135–144). Finally, we discuss the relevance of this effect to experimental dynamos and present ways to increase the dynamo efficiency and reduce the instability threshold.