creating ssh key with no passphrase

creating ssh key with no passphrase

Post by Ron Eggle » Wed, 19 Mar 2008 07:04:44



Hi,

I'm trying to create an ssh key automatically with no passphrase but
ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N="" would tell me:
passphrase too short: have 1 bytes, need > 4
How am I able to create a key for automatic file exchange with no human
interaction?

Thank you!
Ron

 
 
 

creating ssh key with no passphrase

Post by Ron Eggle » Wed, 19 Mar 2008 07:24:31



> Hi,

> I'm trying to create an ssh key automatically with no passphrase but
> ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N="" would tell me:
> passphrase too short: have 1 bytes, need > 4
> How am I able to create a key for automatic file exchange with no human
> interaction?

> Thank you!
> Ron

Ah, I'm not sure if I got it, I tried:
ssh-keygen -N '' -C backup1 -t rsa -f ~/.ssh/id_rsa
and copied the ~/.ssh/id_rsa.pub porrtion into the server's
~/.ssh/known_hosts but for some reason it wouldn't let me in... :( Any
ideas what i could have done wrong? Or is my keygen command "corrupt"?
Thank you!
--
chEErs roN

 
 
 

creating ssh key with no passphrase

Post by Joe Beasle » Wed, 19 Mar 2008 11:18:58




>> Hi,

>> I'm trying to create an ssh key automatically with no passphrase but
>> ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N="" would tell me:
>> passphrase too short: have 1 bytes, need > 4
>> How am I able to create a key for automatic file exchange with no human
>> interaction?

>> Thank you!
>> Ron
> Ah, I'm not sure if I got it, I tried:
> ssh-keygen -N '' -C backup1 -t rsa -f ~/.ssh/id_rsa
> and copied the ~/.ssh/id_rsa.pub porrtion into the server's
> ~/.ssh/known_hosts but for some reason it wouldn't let me in... :( Any
> ideas what i could have done wrong? Or is my keygen command "corrupt"?
> Thank you!

Leave out the -N option.  This will prompt you for a password, and let
you hit enter for a blank password.
 
 
 

creating ssh key with no passphrase

Post by Ron Eggle » Thu, 20 Mar 2008 01:33:53





>>> Hi,

>>> I'm trying to create an ssh key automatically with no passphrase but
>>> ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N="" would tell me:
>>> passphrase too short: have 1 bytes, need > 4
>>> How am I able to create a key for automatic file exchange with no human
>>> interaction?

>>> Thank you!
>>> Ron
>> Ah, I'm not sure if I got it, I tried:
>> ssh-keygen -N '' -C backup1 -t rsa -f ~/.ssh/id_rsa
>> and copied the ~/.ssh/id_rsa.pub porrtion into the server's
>> ~/.ssh/known_hosts but for some reason it wouldn't let me in... :( Any
>> ideas what i could have done wrong? Or is my keygen command "corrupt"?
>> Thank you!

> Leave out the -N option.  This will prompt you for a password, and let
> you hit enter for a blank password.

Joe, I want to be able to generate the key without any user interaction.
So the -N option is needed. The problem i have now is, that the public key I
pasted into ~/.ssh/authorized_keys wouldn't work. It doesn't let me in...
(
Aany ideas what could be the problem?
Both, server & client are using ssh2.

--
chEErs roN

 
 
 

creating ssh key with no passphrase

Post by Andrew Gideo » Thu, 20 Mar 2008 01:56:51



> Ah, I'm not sure if I got it, I tried: ssh-keygen -N '' -C backup1 -t
> rsa -f ~/.ssh/id_rsa and copied the ~/.ssh/id_rsa.pub porrtion into the
> server's ~/.ssh/known_hosts but for some reason it wouldn't let me in...
>  Any ideas what i could have done wrong? Or is my keygen command
> "corrupt"?

It looks like you found your previous problem (-N="").  As to why the key
is not working, you need to put the public part in the destination
login's authorized_keys2 file.

known_hosts doesn't solve the client authentication problem (let me
login!) but the server authentication problem (is the server into which
I'm logging in really what I think it is?).

BTW, I'd not generally name the key id_rsa.  That has a special meaning.  
I'd call it something else, and then explicitly use it either via "ssh -i
keyname" or by placing an entry for the server in the client login's
~/.ssh/config file.

        - Andrew

 
 
 

1. creating ssh key with no passphrase

Hi, I also want to be able to create a passphrase-less ssh-key without
any user interaction (like the original poster), but from a batch
script... The funny thing is this:

-- this line, directly typed in the shell, works:

$ ssh-keygen -N '' -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key
Generating public/private rsa key pair.
Your identification has been saved in /mydir/usr2-blahblah.key.
Your public key has been saved in /mydir/usr2-blahblah.pub.
The key fingerprint is: ...

-- however, when I try to toss it into a variable, and execute the
variable contents, it doesn't:

$ mycmd="ssh-keygen -N '' -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key"
$ echo $mycmd
ssh-keygen -N '' -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key
$ $mycmd
Generating public/private rsa key pair.
passphrase too short: have 2 bytes, need > 4
Saving the key failed: /mydir/usr2-blahblah.key.

Apparently, it interprets the quotes in the second case as literal
password characters instead of string delimiters.. Btw, none of the
escaping possibilities work:

$ mycmd="ssh-keygen -N '' -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key"
$ mycmd="ssh-keygen -N \'\' -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key"
$ mycmd="ssh-keygen -N \"\" -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key"
$ mycmd="ssh-keygen -N """" -C 'comment' -t rsa -b 1024 -f /mydir/usr2-
blahblah.key"

... I need this because I want to do something like:

mycmd="ssh-keygen -N '${PASSWDVAR}' -C 'comment' -t rsa -b 1024 -f /
mydir/usr2-blahblah.key"

where PASSWDVAR would be passed to the bash script - and this in fact
works fine, for all cases but when $PASSWDVAR is empty string...

Any help to achieve what I'd want?

Thanks...

2. Wanted: Tool for mounting filesystems in RH7.1

3. ssleay help: req creates SSL key with passphrase???

4. Using the ~%take command under cu

5. ssh dsa passphrase

6. using KDE 2 on LinuxPPC 2000 Q4

7. access of private key passphrases

8. DOS/NT/Linux bootup config?

9. generating a ssh key without ssh-keygen

10. How to use pub keys (not ssh password) in ssh command?

11. RH9: "gpg --gen-key" fails to create keys

12. can ssh-agent work between ssh-2.3 and ssh-3.5

13. Could not create directory '//.ssh'. SSH + keys + Win2K + UNIX (using BASH)