“The more we know about factors that influence the human microbiome, including microbes coating our skin, the more we understand about the barriers that protect our bodies from disease, train our immune system and connect to the environments that we inhabit,” Dr. Neufeld wrote.

Other factors, like gender, influence a person’s microbiome even more than proximity to a partner, researchers said. A sample taken from one part of a person’s body will match a sample from another part of her body more closely than it will matches her partner’s.

But a lover still plays an important role in shaping your microbial profile, said Ashley Ross, co-author of the new study and a master’s student in biology at the University of Waterloo. “It’s not the main influence, but it’s one more piece of the puzzle.”

In addition to the feet, sexual partners share similar microbial communities on the torso, navel and eyelids, the study showed. Some of that exchange might occur from sleeping in the same bed and sharing sheets, Ms. Ross said.

She and her colleagues also found that the microbial communities on a person’s inner thigh were specific to gender. Computer algorithms were able to differentiate between men and women with 100 percent accuracy by analyzing these samples alone.

It may have to do with the fact that the bacteria on women’s inner thighs are influenced by the vaginal microbiome, Ms. Ross said.

Given the small sample size of 20 participants, it’s difficult to generalize the results to all populations, she and her colleagues said. It would be useful to study same-sex couples in the future, as well as couples of various ethnicities and races.

Eventually, Dr. Neufeld said, the findings may have practical applications for the design of public and shared spaces to reduce the spread of pathogens between individuals.