LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2013, 02:21 PM   #1
hrohibil
LQ Newbie
 
Registered: Aug 2013
Posts: 16

Rep: Reputation: Disabled
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
 
Old 08-08-2013, 02:49 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
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.
 
Old 08-08-2013, 02:57 PM   #3
hrohibil
LQ Newbie
 
Registered: Aug 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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

Last edited by hrohibil; 08-08-2013 at 03:03 PM. Reason: Added question regarding authorized_keys file
 
Old 08-08-2013, 03:35 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
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.
 
Old 08-08-2013, 04:21 PM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,774
Blog Entries: 1

Rep: Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339
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.
 
Old 08-08-2013, 04:47 PM   #6
hrohibil
LQ Newbie
 
Registered: Aug 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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...
 
Old 08-08-2013, 04:49 PM   #7
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,774
Blog Entries: 1

Rep: Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339
You can turn off PasswordAuth in your sshd_config file. And allow only PublicKey auth...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passwordless ssh without ssh keys Four Linux - General 1 04-27-2011 03:20 AM
How to set SSH keys on SSH server mansour Linux - Newbie 27 01-16-2011 12:44 PM
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 05:40 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 07:03 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 04:31 AM


All times are GMT -5. The time now is 10:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration