Make sure that the user has a .ssh directory in their home directory, otherwise keygen can fail.