I have 2 users, userA and userB. userB needs to run some commands as userA. I have specified these options in /etc/sudoers
as below:
userA ALL=(ALL) ALL
userB ALL=(vinoth) /sbin/fdisk
I ran this command as userB:
sudo -u userA fdisk -l
It asked for the password of userB. Once I entered the password, the command didn't give the fdisk output.