During the reign of Emperor Jing of Han (Liu Qi), there was a man named Zou Yang, known for his sharp intellect. Initially, he served alongside Yan Ji and Mei Cheng under Liu Bi, the King of Wu. Because they were all gifted in both literary talent and eloquence, Liu Bi held them in high regard.
Later, when King Liu Bi of Wu plotted rebellion, Zou Yang refused to participate and fled with Yan Ji and Mei Cheng to take refuge under King Liu Wu of Liang. However, Liu Wu's trusted advisors Yang Sheng and Gongsun Sui, who resented the newcomers, slandered them heavily. Believing their lies, Liu Wu lost trust in Zou Yang and threw him into prison, intending to execute him. Deeply aggrieved by his unjust treatment, Zou Yang wrote a letter from his cell—the famous "Letter to the King of Liang from Prison." In it, he argued: "If a ruler today could shed his arrogance, treat scholars with sincerity, and remain consistent whether they are poor or noble, then 'the dog of Jie could be made to bark at Yao, and the follower of Zhi could be made to assassinate Xu You'—meaning even a tyrant's dog can be commanded to bite a sage, and a bandit's comrade can be ordered to kill a virtuous hermit." This passage later condensed into the idiom "Jie's dog barking at Yao" or "Zhi's dog barking at Yao."
“Barking at those who are not its master” means a dog always knows to bite anyone who is not its owner. This phrase is often paired with “Zhi’s dog barking at Yao,” forming “Zhi’s dog barks at Yao, barking at those not its master.” It is also said as “a dog barks at a non-master.” Later, it is used as a metaphor for a subject serving only his own lord.
Source: *Strategies of the Warring States*, Chapter "Strategies of Qi"
Meaning of the Idiom: Later, the Chinese idiom "吠非其主" came to describe how a subject serves only his own lord.