Results 1 to 2 of 2

Thread: SSH Keys

  1. #1
    Join Date
    Nov 2011
    Location
    Dallas, TX
    Posts
    31
    Thanks
    0
    Thanked 8 Times in 3 Posts
    Rep Power
    10

    Post SSH Keys

    There are two machines A and B. The idea is to login (via ssh) from A to B without typing the password that machine B would normally ask for. A is called the client and B is called the server.

    A single command on the client A does this (replace SERVERB by the correct machine name or IP address of server B ):

    Code:
    ssh-keygen -t dsa -f ~/.ssh/identity && cat ~/.ssh/identity.pub | ssh SERVERB 'sh -c "cat - >>~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2"'

    Press enter twice. Then it will ask you for password when u run this command but this will be the last time it will ask. After this, you can jump to step 4 below.

    Generate your public and private keys on client A, by running:

    Code:
    ssh-keygen -t dsa -f ~/.ssh/mykey

    Just hit enter twice for the passphrase query.

    Next, copy your public key on client A to Server B. Run the command:

    Code:
    cat ~/.ssh/mykey.pub | ssh SERVERB 'sh -c "cat - >>~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"'

    It will ask you for your password. Don't worry, this is the last time you will have to type it in.

    This puts your public key on server B, in a special file that holds trusted public keys, and gives it appropriate permissions so that its readable by you only.

    Move your private key to a file ssh looks for by default and make it secret by running this on client A:

    Code:
    mv ~/.ssh/mykey ~/.ssh/identity && chmod 600 ~/.ssh/identity

    Since this file is like your password, it must be readable by you only.

    You are all set. Now run:

    Code:
    ssh SERVERB

    And server B should let you login without password.
    Last edited by steelmanronald06; 05-15-2012 at 03:53 PM.
    Visit my MySQL Forum at MySQLExchange.com for MySQL help, articles, tutorials, tips and tricks.




  2. #2
    arran Guest
    thanks you "steelmanronald06"

 

 

Similar Threads

  1. SSH Keys
    By MustangV10 in forum Server Security
    Replies: 8
    Last Post: 11-28-2011, 10:22 AM

Bookmarks

Posting Permissions

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








Check out Linux Central for Linux software and other goodies!





» Stats

Members: 3,580
Threads: 3,920
Posts: 9,446
Top Poster: Fred (1,486)
Welcome to our newest member, SLW210

» Links



Powered by vBadvanced CMPS