• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RSA key error

 
rama ilango
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my php file is
<?php
$output=shell_exec("sh autorun.sh");
echo "$output";
?>

my shellscript autorun.sh is
echo "enter"
result=`ssh root@192.xxx.xxx.xxx ls`
echo "$result"

When i run the autorun.sh in command prompt, it display
enter
airhead
airhead.tgz
anaconda-ks.cfg
Desktop

the above result is correct.

When i run the autorun.sh from above php file the following error will display
enter
RSA key fingerprint is 01:fe:fa:cb:63:ad:9c:11:69:67:90:ce:ea:2f:19:4a


How to solve this problem?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's the prompt for permission.

Presumably, you're running PHP inside Apache. That means that instead of adding the remote machine to your .ssh/known_hosts file, it wants to add it to Apache's .ssh/known_hosts file.

Just to make it more interesting, the Apache account often isn't set up to be logged in, so it may not have a home directory.

I'm sure that there's ways of handling this. One of them would be to set up a certificate so that Apache is already certified and doesn't even need to use a password to communicate.

Of course, if all you're using ssh for is to interact with a remote file system, you may find it better to mount the files using NFS or Samba and avoid the need for ssh altogether.
 
rama ilango
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to set up the certificate for apache and doesn't ask password to communicate?
Please give steps for set up certificate for apache.
 
rama ilango
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i got a error like this while try to connect a remote server. Can you help me?

spawn ssh root@x.x.x.x
Could not create directory '/.ssh'. The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established. RSA key fingerprint is 45:fb:f7:75:0e:37:31:06:69:dd:11:05:e7:38:0f:ae. Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/.ssh/known_hosts).
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rama ilango wrote:Actually i got a error like this while try to connect a remote server. Can you help me?
Could not create directory '/.ssh'. The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established.

The second is not an error, its a warning. It is telling you exactly what the problems are.

While logged in as the user you are running your code under, do the ssh command manually in the shell. Make sure it creates the needed directory, and when it asks if you want to accept the key, enter yes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic