2

I have two users in my CentOS system User1 and User2. I am logged in as root user and trying to add User1 to sudoer list using visudo. I have entered the following line at the end of the file

User1 ALL = (ALL) NOPASSWD: ALL

But, when I log in as User1 the su User2 command gives me a password prompt. I do not want to provide password and instead User1 should be able to switch to User2 without any password.

4

The /etc/sudoers config file doesn't configure the su command, which will always prompt for credentials in accordance with whatever's in /etc/pam.d/su. The command you're looking for is sudo -iu User2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.