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. (Using translation from Abū Dāʾūd 4017)
أَنَّهُ قَالَ يَا نَبِيَّ اللهِ عَوْرَاتُنَا مَا نَأْتِي مِنْهَا وَمَا نَذَرُ؟ قَالَ احْفَظْ عَوْرَتَكَ إِلَّا مِنْ زَوْجَتِكَ أَوْ مَا مَلَكَتْ يَمِينُكَ قُلْتُ أَرَأَيْتَ إِنْ كَانَ الْقَوْمُ بَعْضُهُمْ مِنْ بَعْضٍ؟ قَالَ إِنِ اسْتَطَعْتَ أَنْ يَرَاهَا أَحَدٌ فَلَا يَرَاهَا قُلْتُ أَرَأَيْتَ إِذَا كَانَ أَحَدُنَا خَالِيًا؟ قَالَ اللهُ أَحَقُّ أَنْ يُسْتَحْيَا مِنْهُ مِنَ النَّاسِ أَشَارَ الْبُخَارِيُّ إِلَى هَذَا الْحَدِيثِ فِي التَّرْجَمَةِ