Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was trying to send files from machine A to machine B.

For that, I created a public-private key pair using ssh-keygen -t rsa in machine A. Then I sent the id_rsa.pub file to machine B and I added that to the authorized_keys file there.

It was working fine while sending from machine A to B, I was not being prompted for the password.

While doing some other experiments with this I accidently deleted the authorized_keys file. Now again when I started the above procedure its not working. How to recover that? I am also interested to know is it possible to send files both ways round without being prompted for password?

share|improve this question
Use ssh-copy-id after deleting your authorized_keys file. Do you still have problems? – Nils Sep 6 '12 at 21:41
Usually the problem is invalid permissions on the authorized_files or the .ssh directory or the home directory. See the “troubleshooting” section in the tag wiki. – Gilles Sep 6 '12 at 21:42
up vote 3 down vote accepted

There is something wrong in your newly created authorized_keys.

  1. Check the permissions, the recommended permissions are read/write for the user, and not accessible by others.
  2. Check that you don't have extra line breaks in the file and that the key in it actually matches the (correct) public key of A.

Note that you don't need to recreate the key pair.

If you want to have public key access from B to A, just replicate the process (create keys in B, move pub to A and add to authorized_keys in there).

Note that public key authorization is the way to identify client to server. In order to be able to use B as a client, you need to have sshd running in A.

Of course you can use scp from A also to transfer files from the server B to A without a password, if that was what you ment by "send files both way round without being prompted for password": scp serverB:filename .

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.