The importance of neutral and niche processes for bacterial community assembly differs between habitat generalists and specialists.