Sudo () cloth does not match env.password

I'm trying to prefill env.password

with --initial-password-prompt

, but the remote throws away some weirdness. Let's say that I am trying to cat

root a file as testuser with 600 file permissions. I call sudo('cat /home/testuser/test.txt')

and get this back:

[testuser@testserver] sudo: cat /home/testuser/test.txt
[testuser@testserver] out: cat: /home/testuser/test.txt: Permission denied
[testuser@testserver] out:
Fatal error: sudo() received nonzero return code 1 while executing!
Requested: cat /home/testuser/test.txt
Executed: sudo -S -p 'sudo password:'  -u "testuser"  /bin/bash -l -c "cat /home/testuser/test.txt"

      

Is this request back to login? I tried using sudo()

with pty=False

to see if there was a pseudo-terminal issue, but to no avail.

Here's the weird part: calling run('sudo cat /home/testuser/test.txt')

and calling fab

without --initial-password-prompt

returning a password prompt from the remote computer and when the password is entered everything works fine.

Naturally, the launch ssh -t testuser@testserver 'sudo cat /home/user/test.txt'

asks for a password and correctly returns the contents of the file. I have a problem with my server shell configuration, or a problem with how I use it sudo()

?

Down the line, I'll probably set up a deployment user with no password sudo

and limited commands. This will probably cause a problem, but I would like to consider this option if possible. I am using Ubuntu 14.10 VPS if needed.

+3


source to share


1 answer


Oh my mistake. I recklessly installed env.sudo_user

on my custom tester for deployment, assuming it is pointing the caller to the remote machine. In fact, it was pointing to the target user and I was trying sudo

in myself. Oops.



+1


source







All Articles