Yes, according to man sudoers
this is allowed.
However, the way you have it it might not work the way you intend to. The part in the parentheses is the user(s), which are allowed to be impersonated via sudo.
Your existing line allows the user myuser
to run commands as myuser
without using a password, which doesn't make much sense (he can run commands as himself without sudo anyway).
Your modified line allows the user myuser
to run commands as himself, or as the user myuser2
. If this is what you want, fine.
If you want both myuser
and myuser2
to run commands as myuser
, you have to add myuser2
at the beginning:
myuser, myuser2 ALL=(myuser) NOPASSWD: ALL
If you want to allow these two users to run administrative commands it should be:
myuser, myuser2 ALL=(ALL) NOPASSWD: ALL