On machine A and B (both running CentOS 7), I have:
# cat /etc/sudoers.d/custom
userA ALL=(userB:userB) NOPASSWD:ALL
However, on machine A, when I run
[userA] $ sudo -ui userB
sudo: unknown user: i
sudo: unable to initialize policy plugin
when I run
[userA] $ sudo -iu userB
sudo: unknown user: env
sudo: unable to initialize policy plugin
Tho, on machine B, both commands work fine.
userA
and userB
both exist on both machines.
Any idea?
Update 1 (based on @Bart's suggestion):
[userA]$ sudo -u -i userB
sudo: unknown user: -i
sudo: unable to initialize policy plugin
[userA]$ sudo -i -u userB
Need at least 3 arguments.
Run scl --help to get help.
[userA]$ sudo -u userB -i
Need at least 3 arguments.
Run scl --help to get help.
[userA]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'