All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The Hadeeth in question was narrated by Ibn Maajah on the authority of Thawbaan who directly attributed it to the Prophet, sallallaahu ‘alayhi wa sallam.
It refers to those who only refrain from committing sin in public and pretend to be righteous; but once they are alone and no one can see them, they violate the commandments of Allaah The Exalted.
In other words, it refers to people who do not care that Allaah The Exalted sees them, and they fear people more than they fear Him.
However, we hope that this threat does not apply to the person who strives to keep away from prohibitions but sometimes his weakness gets the better of him and he does not insist on committing sins.
Allaah Knows best.