Root-nodule bacteria (rhizobia) are of great importance for nitrogen acquisition through symbiotic nitrogen fixation in a wide variety of leguminous plants. These bacteria differ from most other soil microorganisms by taking dual forms, i.e. a free-living form in soils and a symbiotic form inside of host legumes. Therefore, they should have a versatile strategy for survival, whether inhabiting soils or root nodules formed through rhizobia-legume interactions. Rhizobia generally contain large amounts of the biogenic amine homospermidine, an analog of spermidine which is an essential cellular component in most living systems. The external pH, salinity and a rapid change in osmolarity are thought to be significant environmental factors affecting the persistence of rhizobia. The present review describes the regulation of homospermidine biosynthesis in response to environmental stress and its possible functional role in rhizobia. Legume root nodules, an alternative habitat of rhizobia, usually contain a variety of biogenic amines besides homospermidine and the occurrence of some of these amines is closely associated with rhizobial infections. In the second half of this review, novel biogenic amines found in certain legume root nodules and the mechanism of their synthesis involving cooperation between the rhizobia and host legume cells are also described.