7
7
7761662021-04-09 14:34:11
linux
776166, 2021-04-09 14:34:11

How to make passwordless sudo to become a specific user?

# which sudo
/usr/bin/sudo

And in sudoers:
vasya ALL=(ALL:ALL) NOPASSWD: /usr/bin/sudo -iu pupkin


Doesn't work. How right?

The following code:
vasya ALL=(ALL:ALL) NOPASSWD: /usr/bin/apt update

Works. I sin on the keys, but the sudo editor does not swear at the syntax.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Barbolin, 2021-04-09
@dronmaxman

If so
vasya ALL=NOPASSWD: /usr/bin/sudo -iu pupkin

S
Saboteur, 2021-04-09
@saboteur_kiev

In your case, it’s easier not to configure sudo, but
add a line to /etc/pam.d/su
auth sufficient pam_succeed_if.so user = vasya
and write
su vasya

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question