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

Posted on 2007-10-15
Last Modified: 2013-12-16

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 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.  


Question by:tayloenic
    LVL 28

    Assisted Solution

    by:Jan Springer
    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.
    LVL 39

    Assisted Solution

    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.

    Assisted Solution


    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

    LVL 48

    Accepted Solution

    Make sure perms on your .ssh directory are 700

    Author Comment


    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now