E
E
Evgeny Elizarov2012-07-20 08:07:36
linux
Evgeny Elizarov, 2012-07-20 08:07:36

Apache and ssh logon to remote machine with public key?

There is a machine, it has LAMP, there is another machine that Apache needs to be able to log in and execute a certain command, for example `ssh [email protected] uname -a | awk '{print $3}'`
Authentication by public key comes to mind, but then where to put the key so that Apache would pick it up and log in? At what on the second machine there is no Apache, and he must log in under a different user, can he specify someone else's public key? I understand that this is a donut hole, but this is for a local network where there is no one to play pranks and everything is closed to the outside.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pr0tect0r, 2012-07-20
@pr0tect0r

just specify the path to the key:
ssh -t -i /path/to/key [email protected] command

O
Ogra, 2012-07-20
@Ogra

In order for Apache to be able to log in via ssh, you need to create an ssh key.
It should normally be in /var/www/.ssh
In general, sudo -u apache ssh-keygen -t rsa

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question