Think of "may not" as "can not/can't".

"You can not do this." effectively means the same as "You may not do this" when in the context of a command.

I am not sure what you mean in the second...