Results 1 to 5 of 5

Thread: ssh key generation command

  1. #1
    Join Date
    Feb 2007
    Beans
    20

    Cool ssh key generation command

    I want to run ssh-keygen -f [filename] but also specify no password. I know the -N option is used to specify the password but putting -N with nothing after it isn't permitted. All ideas are welcomed!

  2. #2
    Join Date
    Sep 2009
    Beans
    197
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: ssh key generation command

    Quote Originally Posted by wbrady4927 View Post
    I want to run ssh-keygen -f [filename] but also specify no password. I know the -N option is used to specify the password but putting -N with nothing after it isn't permitted. All ideas are welcomed!
    Code:
    ssh-keygen [filename] -t rsa
    You will be prompted for a pass phrase, simply press enter without entering one and a pass phrase will not be set.

    You might want to check out this page: https://help.ubuntu.com/community/SSH/OpenSSH/Keys
    lewisforlife

  3. #3
    Join Date
    Feb 2007
    Beans
    20

    Re: ssh key generation command

    I should have been more clear. I understand you can do that, but I want to do this without user input. It is a part of an installation script and I don't want to the person running it to have to press Enter. I just want it to know from the command. Thank you for your advice however.

  4. #4
    Join Date
    Sep 2009
    Beans
    197
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: ssh key generation command

    This is just a start:

    Code:
    ssh-keygen -f [filename] | yes ""
    I believe this will achieve what you are looking for. But yes runs forever until killed with ctrl+c, if you can find a way to automatically kill yes after a few seconds that would be ideal.
    lewisforlife

  5. #5
    Join Date
    Sep 2009
    Beans
    197
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: ssh key generation command

    I am not good with bash, but you could run a bash script that does this without prompting:

    Code:
    #!/bin/bash
    
    ssh-keygen -f file | yes "" &
    sleep 1
    killall yes
    exit
    This will create the key pair and set the paraphrase to nothing. There has to be a better way of doing this. I am the king of figuring out round-about complicated ways of doing things.
    lewisforlife

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
  •