Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1859
  • Last Modified:

Want to copy linux files using scp without entering password each time


I am trying to copy files to a server out on the Internet without having to type in a password everytime.  I am going from a local linux (fedora 6) box to another linux box (Cent 4).  My command is:

scp /home/tayloe/filename   tayloe@70.86.x.x:/home/tayloe

It works, but it makes me enter a password each time.  I generated a key pair on the local box (using ssh-keygen -t rsa) and copied the contents of the resulting id_rsa.pub file to a file called authorized_keys on the remote box.  The authorized keys file is in the following 2 directories on the remote box:


I wasn't sure which directory it should be in, so I put it in both.  That procedure is supposed to make it so it stops asking for a password each time, but it still does.  


4 Solutions
Jan SpringerCommented:
scp -i /home/tayloe/.ssh/id_rsa  /home/tayloe/filename  tayloe@70.86.x.x:/home/tayloe/.

And the authorized_keys file belongs in the .ssh directory on the remote.
nociSoftware EngineerCommented:
Also, if Kerberos is available (&configured) then you can enter your password once for all accesses throughout the kerberos domain.
Enter the password using kinit.
Both ssh & scp are capable of using the kerberos tickets you received.

authorized_keys should be in the home directory on the server, i.e. /home/tayloe/.ssh in your case. You can also try creating authorized_keys2, or just symlink it to authorized_keys.

Use either -i option for scp or add
Host 70.86.x.x
  IdentityFile  /home/tayloe/.ssh/id_rsa

to /home/tayloe/.ssh/config on your client box

Make sure perms on your .ssh directory are 700
tayloenicAuthor Commented:

Problem is solved.  I had permissions set too permissive on the server.  I didn't know they could be too permissive!!  I gave tintin the most points because he gave the correct answer even though it took me a while to figure that out.  Thanks to all for responding.


Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now