Without password via RSA algorithm problem

hi All,

i need to connect(sftp) from serverA to serverB via rsa algorithm. But i can not success this.

i did like that:

On ServerA:

#ssh-keygen -t rsa

after running this command, "id_rsa" and "id_rsa.pub" files were generated. i checked.there is private key in id_rsa file and public key in id_rsa.pub file.

#ssh user@serverB mkdir -p .ssh
i checked that on serverB .ssh directory was generated.

#cat .ssh/id_rsa.pub | ssh user@serverB 'cat >> .ssh/authorized_keys'
i checked that public key had been sent to authorized_keys file which is in .ssh directory,serverB

but when i want to connect from serverA to serverB like that
on server A it asked me password:( i dont understand why

# sftp user@serverB
user@serverB's password

Are there any other way connect from one server to another server without password?

Thanks.

Set the permissions of .ssh directory and all the files to 640

i gave permission all files but it still ask me password.

---------- Post updated at 03:20 AM ---------- Previous update was at 03:19 AM ----------

as 777

That is the problem. It should not be given full permission. Please try

chmod -R 640 .ssh

i gave all files 640 permissions.
But when i write on ServerA:
sfpt user@serverB
Connecting to ServerB
The authenticity of host ServerB' can't be established.
RSA key fingerprint is 81:6a:2c:3a:54:39:51:26:b7:96:86:6e:e9:bf:ac:bb.
Are you sure you want to continue connecting (yes/no)?

i wrote yes and i can log in to serverB.
i quited and try again, still it asked me password.

Arent there any other way to connect from one server to another server without password ?

Thanx

sfpt user@serverB
Connecting to ServerB

The problem is sftp. What happens when you log into ServerB using ssh?

same things.

are there any way log in to one server from another server without password?

Yes there is - using ssh or scp but not using sftp. It you want a utility that does all three, take a look at lftp.

Besides the files in .ssh, make sure your home dir and the .ssh dir don't have write permissions except for the owner. Also check /etc/ssh/sshd_config on the server to see if it has

PubkeyAuthentication yes