+ Reply to Thread
Results 1 to 4 of 4

Thread: SSH: Linux Generate Public/Private Key Login

  1. #1
    Tor
    Tor is offline Programming Expert
    Join Date
    Oct 2007
    Posts
    488
    Rep Power
    0

    SSH: Linux Generate Public/Private Key Login

    On your desktop or the computer you want to SSH from run this command:

    Code:
    # ssh-keygen -t dsa
    • You will be asked to enter a location, use the default.
    • Enter a prassphrase (it is not recommended to leave this blank)
    You will see results similar to this:

    Your identification has been saved in /home/username/.ssh/id_dsa.
    Your public key has been saved in /home/username/.ssh/id_dsa.pub.
    The key fingerprint is:
    6b:62:7c:60:81:04:97:3e:62:c8:1c:9e:96:49:11:b4 name@host
    Now you need to put your public key on the remote server in a file at ~/.ssh/authorized_keys2. You can do this one of two ways.

    1) Execute this command:

    Code:
    # cat ~/.ssh/id_dsa.pub | ssh username@hostname 'cat - >> ~/.ssh/authorized_keys2'
    2) Copy/Paste the file.
    • Open ~/.ssh/id_dsa.pub using vi/vim/nana/pico/etc (your favorite editor).
    • Select all of the contents and copy the data into your clipboard.
    • SSH into the remote server
    • vi/vim/nano/pico/etc (your favorite editor) ~/.ssh/authorized_keys2
    • Paste the contents of your clipboard (should be the public key copied from above).
    • Save the file

    That is it! Logout of the remote system and then SSH back into the remote system. If everything worked fine you should be asked for a passphrase.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest
    Thanks Tor, this will be helpful. I'm constantly looking this information up as well.

  4. #3
    phpforfun's Avatar
    phpforfun is offline Speaks fluent binary
    Join Date
    Feb 2008
    Posts
    1,232
    Blog Entries
    17
    Rep Power
    24
    Tor, I am looking into doing this, do you mind explaining how to reverse the process? Say you wanted to remove a key. Do you delete the key files, or clear them out?
    Checkout my new forum! http://adminreference.com/

  5. #4
    Jordan Guest
    If you want to remove a single key just remove it from this file:~/.ssh/authorized_keys2
    It is easy to see how they are segmented and delete only one. Alternatively you can delete the whole file to remove all keys.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How are algorithms that can produce public/private key pairs made
    By liamzebedee in forum Software Security
    Replies: 2
    Last Post: 06-05-2011, 12:52 PM
  2. Windows User Login into Linux Server?
    By WhyLinux in forum Linux Networking
    Replies: 1
    Last Post: 05-28-2011, 07:21 AM
  3. Replies: 2
    Last Post: 07-16-2010, 04:50 AM
  4. Simple Q on Public and Private types
    By Namesake in forum C and C++
    Replies: 2
    Last Post: 02-26-2010, 07:28 AM
  5. Passing string from one private sub to another private sub
    By terrylau in forum Visual Basic Programming
    Replies: 1
    Last Post: 07-10-2009, 05:24 AM

Tags for this Thread

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