Much scholarly study has been devoted to Kipling's inspiration for the story - the author never explicitly said. In my opinion most likely to be either Alexander Gardner or Josiah Harlan, or indeed, a conflation of the two. Kipling working as a journalist in northern India would have put him in the right place to pick up traveller's tales of the extremely eccentric pair. There are excellent biographies on them - well worth a read if you are interested. - I.I'll read "The Man Who would be King" next as I have only seen the film...