LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how many ssh keys can there exsist? (https://www.linuxquestions.org/questions/linux-newbie-8/how-many-ssh-keys-can-there-exsist-4175472672/)

hrohibil 08-08-2013 01:21 PM

how many ssh keys can there exsist?
 
Hi

is the title suggest how many ssh keys can there exsist?

I am trying to setup authentication with putty from Windows. I am connected to my nas as the server.

i keep getting public key refused. So i have re done tutorials without deleting old stuff after me.

I have also tried from within the ssh comnand
line ssh keygen but still no luck. Is there a way to fo a clean restart again?

Br Hamid

rtmistler 08-08-2013 01:49 PM

Forget how many keys, delete the key resource file and it should start fresh. In Linux it should be in .ssh directory in your login's home tree. Mine is called known_hosts and upon looking at that file I'd not recommend trying to edit it; however deleting it means that other hosts which were previously accepted will be reset too.

hrohibil 08-08-2013 01:57 PM

Ok.

So in my .ssh folder i have theese 4 files:
authorized_keys
id_dsa
id_dsa.pub
known_hosts

what about the authorized_keys file? I have as part of a tutorial pasted a publickey text into it, should i delete the authorized_keys and create a new one by typing touch authorized_keys?

Should i delete all those files, or just known_hosts??

Or did you mean the folder it self?


After it is "reset", would you recommend generating keys from putty or use the command line ssh keygen?

Br Hamid

rtmistler 08-08-2013 02:35 PM

My variation only has known_hosts and I delete that file only. However to be safe, you could copy that whole directory to another place so as to be capable of restoring, and then delete the known_hosts file. It would seem intuitive to remove the authorized_keys file; just that my local experience is that I solely have known_hosts. I also only ever do is scp.

By the way, this is on the "source" system from which I perform the scp. I.e. if I'm on system B performing and SCP to system A, I delete the known_hosts file on system B and the next action of trying scp causes the shell to give me the message that the authenticity of the other host can't be established and asks me if I want to authorize and continue.

szboardstretcher 08-08-2013 03:21 PM

Well,.. Depends on the key length.

I believe we just put the key length after 2.

2**2048 is how many combinations there are for a 2048-bit key. Thats "a lot." And I'm sure that can be broken down into better math, but it should be close.

hrohibil 08-08-2013 03:47 PM

Ok thanks guys i made it work. But when i try to login without the private key i can still just enter my password and login??

I want only to be authenticated by keys.

hmmm...

szboardstretcher 08-08-2013 03:49 PM

You can turn off PasswordAuth in your sshd_config file. And allow only PublicKey auth...


All times are GMT -5. The time now is 12:13 PM.