Sunan Abi Dawud, Book 31, Hadith 4006 (USC-MSA)

Bahz b. Hakim said that his father told on the authority of his grandfather: I said: Messenger of Allah, from whom should we conceal our private parts and to whom can we show? He replied: conceal your private parts except from your wife and from whom your right hands possess (slave-girls). I then asked: Messenger of Allah, (what should we do), if the people are assembled together? He replied: If it is within your power that no one looks at it, then no one should look at it. I then asked: Messenger of Allah if one of us is alone, (what should he do)? He replied: Allah is more entitled than people that bashfulness should be shown to him.

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ، حَدَّثَنَا أَبِي ح، وَحَدَّثَنَا ابْنُ بَشَّارٍ، حَدَّثَنَا يَحْيَى، نَحْوَهُ عَنْ بَهْزِ بْنِ حَكِيمٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، قَالَ قُلْتُ يَا رَسُولَ اللَّهِ عَوْرَاتُنَا مَا نَأْتِي مِنْهَا وَمَا نَذَرُ قَالَ ‏"‏ احْفَظْ عَوْرَتَكَ إِلاَّ مِنْ زَوْجَتِكَ أَوْ مَا مَلَكَتْ يَمِينُكَ ‏"‏ ‏.‏ قَالَ قُلْتُ يَا رَسُولَ اللَّهِ إِذَا كَانَ الْقَوْمُ بَعْضُهُمْ فِي بَعْضٍ قَالَ ‏"‏ إِنِ اسْتَطَعْتَ أَنْ لاَ يَرَيَنَّهَا أَحَدٌ فَلاَ يَرَيَنَّهَا ‏"‏ ‏.‏ قَالَ قُلْتُ يَا رَسُولَ اللَّهِ إِذَا كَانَ أَحَدُنَا خَالِيًا قَالَ ‏"‏ اللَّهُ أَحَقُّ أَنْ يُسْتَحْيَا مِنْهُ مِنَ النَّاسِ ‏"‏ ‏.‏

sunnah.com