This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes RSA key error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "RSA key error" Watch "RSA key error" New topic
Author

RSA key error

rama ilango
Greenhorn

Joined: Dec 11, 2008
Posts: 24
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

Joined: Jun 25, 2001
Posts: 16303
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
rama ilango
Greenhorn

Joined: Dec 11, 2008
Posts: 24
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

Joined: Dec 11, 2008
Posts: 24
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

Joined: Aug 11, 2007
Posts: 4659
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RSA key error