It has been narrated on the authority of Alqama b. Wai'l al-Hadrami who learnt the tradition from his father. The latter said
Salama b. Yazid al-ju'afi asked the Messenger of Allah (ﷺ): Prophet of Allah, what do you think if we have rulers who rule over us and demand that we discharge our obligations towards them, but they (themselves) do not discharge their own responsibilities towards us? What do you order us to do? The Messenger of Allah (ﷺ) avoided giving any answer. Salama asked him again. He (again) avoided giving any answer. Then he asked again-it was the second time or the third time-when Ash'ath b. Qais (finding that the Prophet was unnecessarily being pressed for answer) pulled him aside and said: Listen to them and obey them, for on them shall he their burden and on you shall be your burden.
It has been narrated through a different chain of transmitters, on the authority of Simak who said
Ash'ath b. Qais pulled him (Salama b. Yazid) when the Messenger of Allah (ﷺ) said: Listen to them and obey them, for on them shall be the burden of what they do and on you shall be the burden of what you do.