Trying to use file.append with sudo option:
# ctx is fabric context
files.append(ctx, filename='/home/foo/.profile', text='export foo=bar', sudo=True)
The underneath cmd looks like:
sudo -S -p '[sudo] password: ' echo 'export foo=bar' >> /home/foo/.profile
and giving err msg:
bash: /home/foo/.profile: Permission denied
Also tried with runner_method='sudo' or runner=ctx.sudo and facing same issue
Found something might related
https://unix.stackexchange.com/questions/4335/how-to-insert-text-into-a-root-owned-file-using-sudo
Trying to use
file.appendwithsudooption:The underneath cmd looks like:
and giving err msg:
bash: /home/foo/.profile: Permission deniedAlso tried with
runner_method='sudo'orrunner=ctx.sudoand facing same issueFound something might related
https://unix.stackexchange.com/questions/4335/how-to-insert-text-into-a-root-owned-file-using-sudo