Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabric 3.2.2 asks for sudo password when executing NOPASSWD command #2287

Open
nmtitov opened this issue Nov 2, 2023 · 0 comments
Open

Fabric 3.2.2 asks for sudo password when executing NOPASSWD command #2287

nmtitov opened this issue Nov 2, 2023 · 0 comments

Comments

@nmtitov
Copy link

nmtitov commented Nov 2, 2023

I have configured sudoers to let me execute two commands without password:

# Allow foobar restart app_server
Cmnd_Alias RESTART = /home/foobar/restart_nginx, /home/foobar/bin/restart_app_server
foobar ALL = NOPASSWD : RESTART

When I ssh to the server I can execute both commands without password:

sudo /home/foobar/bin/restart_app_server
sudo /home/foobar/bin/restart_nginx

However when I do the same with Fabric I get the following error:

sudo /home/foobar/bin/restart_app_server
sudo /home/foobar/bin/timers_nginx
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required

This is what my fabfile looks like:

    conn = Connection(local_settings.FABRIC_HOST, port=local_settings.FABRIC_PORT)
    conn.run(
        f"sudo /home/foobar/bin/restart_app_server && "
        f"sudo /home/foobar/bin/timers_nginx", echo=True)

I tried shell=False, tried sudo(...) instead of run(...). No difference at all. This issue appeared after updating from Fabric 2.x.x to Fabric 3.x.x. But I can use old Fabric 2.x.x. right now.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant