The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Confusion with ssh keys...

Discussion in 'Security' started by fkatzenb, Jan 1, 2010.

  1. fkatzenb

    fkatzenb Well-Known Member

    Joined:
    Sep 23, 2009
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Lusby, Maryland, United States
    cPanel Access Level:
    Root Administrator
    I have managed to confuse myself when it comes to SSH Keys.

    I have three servers... server, ns1, and ns2.

    I have seperate DSA public keys in the authorized_keys file such that I can use putty and ssh into each server from my PC with the respective private keys. Each server has it's own independent key.

    If I use the appropriate private keys, I can connect in either direction. However I have to use the -i and list the private key's file name.

    What do I need to do to connect to the server automatically? This is needed for rsync, etc.

    Thanks!

    Frank
     
  2. eth00

    eth00 Well-Known Member
    PartnerNOC

    Joined:
    Mar 30, 2003
    Messages:
    723
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    NC
    cPanel Access Level:
    Root Administrator
    Where do you have the keys located? The user that connects should have it in ~/.ssh/id_dsa

    So if it is root /root/.ssh/id_dsa or if it is user backup /home/backup/.ssh/id_dsa

    My guess is the file is just in a different location then ssh expects. You also can change /etc/ssh/ssh_config and put a different id_dsa location
     
  3. serversignature

    serversignature Well-Known Member

    Joined:
    Nov 26, 2007
    Messages:
    107
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Bangalore
    Try to see where the problem is using -v Verbose mode. Causes ssh to print debugging messages about its progress.

    This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.

    Code:
    @dell:~$ ssh root@192.168.1.1 -vv
    
    OpenSSH_4.7p1 Debian-8, OpenSSL 0.9.8k 25 Mar 2009
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 192.168.1.1 [192.168.1.1] port 22.
    debug1: Connection established.
    
    Thanks,
    Kiran
     
  4. forlinuxsupport

    forlinuxsupport Well-Known Member
    PartnerNOC

    Joined:
    Dec 22, 2004
    Messages:
    386
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Try this

    Code:
    rsync -ave "ssh -i ~/.ssh/id_dsa"  /local/path    IP@remote-path
    With rsync you use the -e and then specify the ssh parameters in double quotes.

    Provided your keys DONT have a password, it should log you in fine.
    So it can now be run from scripts.

    Make the sure keys are in the ".ssh" directory of the user who is running the commands.
     
Loading...

Share This Page