Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, I'm setting up an automated remote back up system. I want to back up some parts of server A on server B (using cron). I've created the public and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Posts
    4

    sshd_config settings when using public key


    Hi,
    I'm setting up an automated remote back up system.
    I want to back up some parts of server A on server B (using cron).
    I've created the public and private dsa key pair and installed them in
    /root/.ssh/ on both servers.
    I've renamed the public key on server B to authorized_keys
    But, when I try to log in to to server B from A, it still asks me for my password.
    Do I need to edit the sshd_config file in some way? On server B only, or both? Any other problems that might be occuring.
    Many thanks.
    Graham

  2. #2
    Just Joined!
    Join Date
    Aug 2005
    Posts
    27
    you should copy and paste the content of identity.pub of A to the /root/.ssh/authorized_keys file of B

    this should work, if not have you check that both servers are using dsa ?

  3. #3
    Just Joined!
    Join Date
    Sep 2005
    Posts
    4
    Hi,
    I've copied the ida_dsa.pub file to authorized_hosts.
    If I use -v when trying to ssh, it tells me that server B is known and matches the RSA host key and that the signature is correct, but then it goes on to says "Authentication that can continue: password, keyboard-interactive" and then asks for the password.
    Not quite sure how to check if a server is using dsa?
    Any help would be greatfully accepted :(
    Cheers

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2005
    Posts
    27
    try to drop the /root/.ssh.identity.pub from A in the authorized_keys of B not the /etc/ssh/id_dsa.pub

    cheers

  6. #5
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    Don't forget
    Code:
    PubkeyAuthentication yes
    in your sshd_config file. Then restart the sshd service.

    If it's still prompting you for a password after that, what are the permissions on ~/.ssh and its contents on both the client and server side?

  7. #6
    Just Joined!
    Join Date
    Sep 2005
    Posts
    4
    Quote Originally Posted by anomie
    Don't forget
    Code:
    PubkeyAuthentication yes
    in your sshd_config file. Then restart the sshd service.
    Check.

    If it's still prompting you for a password after that, what are the permissions on ~/.ssh and its contents on both the client and server side?
    Permissions on server A - .ssh = 700, id_dsa = 600
    Permissions on server B - .ssh = 700, authorized_keys = 644

    This is what I get when I try to ssh from A to B (I've changed the actual IP addresses for the 2 machines to ServerA and ServerB)

    [root@ServerA .ssh]# ssh -v root@ServerB
    OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Rhosts Authentication disabled, originating port will not be trusted.
    debug1: Connecting to ServerB [IP_address] port 22.
    debug1: Connection established.
    debug1: identity file /root/.ssh/authorized_keys type -1
    debug1: identity file /root/.ssh/id_dsa type 2
    debug1: Remote protocol version 2.0, remote software version OpenSSH_3.6.1p2
    debug1: match: OpenSSH_3.6.1p2 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_3.6.1p2
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'ServerB' is known and matches the RSA host key.
    debug1: Found key in /root/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: publickey
    debug1: Trying private key: /root/.ssh/authorized_keys
    debug1: Offering public key: /root/.ssh/id_dsa
    debug1: Server accepts key: pkalg ssh-dss blen 435 lastkey 0x...... hint 1
    debug1: read PEM private key done: type DSA
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: keyboard-interactive
    debug1: Authentications that can continue: publickey,password,keyboard-interactive
    debug1: Next authentication method: password
    root@ServerB's password:

    Can you see anything that might be going wrong?
    Many thanks,
    Graham

  8. #7
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    That's really odd. Try setting this in sshd_config as well:
    Code:
    PasswordAuthentication no
    Then restart sshd again, and try logging in again. If that doesn't work, can the public key authentication work with a user who is not root?

  9. #8
    Just Joined!
    Join Date
    Oct 2008
    Posts
    5

    check security log for clues - most likely permissions issue

    Two Thoughts:

    1.) permissions could be the issue:
    on both machines the complete directory lineage to the certificate must belong to the user and not be writable by groups or others or belong to root.

    2.) the error log on the remote machine /var/log/security should have some information. for me it said something along the lines of "permissions unsuitible /home/user/" the user directory was writable by it's group so i changed that and it works fine now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •