I am having trouble using rsh
in the PHP exec()
command. The error that I'm getting is: Could not create directory '/nonexistent/.ssh'
.
It appears that this is because Apache runs as the user nobody
who does not have a home directory, therefore it cannot find/create a .ssh directory. What I would do from the terminal is something similar to:
sudo su - user_with_home_directory
/usr/bin/rsh -n -l username myserver.com /path/to/my/script.sh
But I am not aware of how to do this using PHP's exec()
command. I don't want to (and cannot) give the nobody user a home directory just to get the problem to go away.
Any help is greatly appreciated to helping me figure out how to get this to work.