Reputation: 426
I would like to know if it was possible to use shell_exec as an other user. The point is to access directly to the user folder (in home/user/)
Or, is it possible to navigate from var/www/ to home/user/ folder using shell_exec?
Thank you for your help!
Upvotes: 2
Views: 1727
Reputation: 8022
Yes you can. You can change directory with cd
command inside shell_exec()
. But make sure you write subsequent commands in the same line after putting ;
Like this,
shell_exec("cd .. ; pwd");
Above function will move directory to current's parent directory and display present working directory.
Upvotes: 3
Reputation: 28529
just like the shell command.
`cd /home/user && you command`
'``'
is similar to shell_exec
in php
Upvotes: 1