Negative commandment · Lo Ta’aseh #84 of 613
Not to anoint an unauthorized person with the anointing oil
שלא לסוך בשמן המשחה זר
The verse · Shemot 30:32
עַל־בְּשַׂר אָדָם לֹא יִיסָךְ וּבְמַתְכֻּנְתּוֹ לֹא תַעֲשׂוּ כָּמֹהוּ קֹדֶשׁ הוּא קֹדֶשׁ יִהְיֶה לָכֶם
“Upon man’s flesh shall it not be poured, neither shall you make any other like it, after the composition of it: it is holy, and holy shall it be for you.”
The Rambam’s words
Not to anoint an unauthorized person with the anointing oil, as [Exodus 30:32] states: "Do not anoint the flesh of a person with it."
שלא לסוך בשמן המשחה זר, שנאמר "על בשר אדם, לא ייסך" (שמות ל,לב).
Why · Sefer HaChinuch #108
To not rub a foreigner (layman) with anointing oil
“It is from the roots of this commandment also [that it is] for the aggrandizement of the [Temple] and everything that is in it. And therefore, it is not fit for commoners to use this precious oil in the [Temple], only the chosen ones of the people alone — and they are the priests and the kings.”
Who & when
“And this commandment of the prohibition of anointing the oil is practiced in every place that it is found and at all times by males and females.”
Where in the Mishneh Torah
Hilchot Vessels of the Sanctuary and Those Who Serve Therein הלכות כלי המקדש והעובדין בו