The lying leg curl is a great exercise for isolating your hamstrings, but you can train these muscles even without a leg curl machine.
Exercises like good mornings, deadlifts, and nordic curls are great for targeting the hamstrings, and can be done with free weights or resistance bands if you don't have access to a gym.