I need to have my web server (apache) send the command "list" using PHP to the user "mike"'s GNU screen session.
the apache user is added to the screen session, and in the sudoers file
I've tried many things to get this working, here are some examples:
<?php
var_dump(exec("sudo -u mike screen -x server1 -p 0 -X stuff \"`printf \"list\"`\";"));
?>
This returned an empty string. Another attempt:
<?php
var_dump(exec("screen -x mike/server1 -p 0 -X stuff \"`printf \"list\"`\";"));
?>
This returned with the following string: "Cannot opendir /var/run/screen/S-mike: Permission denied"
I've been stuck on this problem for weeks now. Any help would be greatly appreciated. Thanks