Be righteous and pious, not only in public, but also in private
According to Osama ibn Sharik (may Allah be pleased with him), it is reported that the Messenger of Allah (peace and blessings of Allaah be upon him) said:
“Do not do something alone with yourself that you would not like to show people.”
“Al-Silsilya al-sahiha” 1055.
Imam al-San’ani said:
“The believer in his deeds should be the same, both in public and alone with himself, because in reality he is never alone with himself. After all, even if he hides from people, he is always under the supervision of Allah and the angels, who write down good and bad deeds. “
See at-Tanuir 9/433.