how to make PHP lists all Linux Users?
Posted
by Data-Base
on Stack Overflow
See other posts from Stack Overflow
or by Data-Base
Published on 2010-05-22T22:26:17Z
Indexed on
2010/05/22
22:30 UTC
Read the original article
Hit count: 159
Hello
I want to build a php based site that (automate) some commands on my Ubuntu Server
first thing I did was going to the file (sudoers) and add the user www-data so I can execute php commands with root privileges!
# running the web apps with root power!!!
www-data ALL=(ALL) NOPASSWD: ALL
then my PHP code was
<?php
$command = "cat /etc/passwd | cut -d\":\" -f1";
echo 'running the command: <b>'.$command."</b><br />";
echo exec($command);
?>
it returns only one user (the last user) !!! how to make it return all users?
thank you
© Stack Overflow or respective owner