I have set up a password-less login from my laptop (OS X) to my dev server (Linux) - this works fine (using ~/.ssh/id_rsa
private key, and having put the contents of ~/.ssh/id_rsa.pub
into the servers ~/.ssh/authorized_keys
file). So far, so good.
However, I am trying to connect to the server from within a PHP script. The Apache server supposedly runs as the _www
user, and I have added the necessary hosts line to ~_www/.ssh/known_hosts
without solving the problem.
I am feeling that there is something basic and fundamental about how Apache on OSX works that I am missing - any suggestions on what I might be doing wrong?
Thanks!
EDIT: I have confirmed that _www
is indeed the currently logged in user, and the home directory is indeed /Library/WebServer
. I added the known host to /Library/WebServer/.ssh/known_hosts
, and I also forgot to mention that the private key file has been made readable by the _www user, and when I call the script I call ssh -i /path/to/private.key
.
I figured it out - the .ssh
directory in /Library/WebServer
was owned by root:wheel
(like the other files and directories in that directory, thus hiding the fact in plain view...). I changed ownership to _www:wheel
, and it works like it should now! Thanks, and sorry for wasting your time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.