mrkeck Sharing the Love

17Jun/160

PHP sudo as user with no password required

Was getting: "sudo: no tty present and no askpass program specified php"
When running:
echo shell_exec("cd /var/www/html/repo/;sudo -u ec2-user /usr/bin/git pull 2>&1");

sudo vim /etc/sudoers
%www ALL = (ALL) NOPASSWD: ALL

sudo usermod -a -G www ec2-user
sudo usermod -a -G www apache
Puts users ec2-user and apache are part of group www

May have to restart server

Filed under: EC2, PHP Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.