LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-02-2003, 03:41 PM   #1
stodge
Member
 
Registered: Jan 2002
Posts: 52

Rep: Reputation: 15
Help with SSH and public/private keys


I have SSH working between my PC when it runs Win2k and my Linux server.

I rebooted the client into Mandrake 9.1 to get SSH working so I can use CVS under Linux as well.

I have my ~/.ssh/authorized_keys setup on the server, and this works because I can login to the server and use CVS from Win2k.

I copied my private key (file identity) from my Win2k partition and put it in ~/.ssh/identity on my Mandrake home partition.

When I try to SSH into the server, it works except I have to enter my password, as though I were logging in through telnet etc.... I presume this means that the private/public key combination isn't being used.

Are there any steps that I missed? Is it ok to copy the private key from the Win32 partition and store it in my home directory? The private key begins with some plain text describing the format of the private key (and not the private key data).

Any help appreciated

Thanks
 
Old 05-02-2003, 09:57 PM   #2
tyler_durden
Member
 
Registered: May 2001
Posts: 125

Rep: Reputation: 15
try running ssh with the -v option, i have found this to be helpfull in debuging authentication issues
 
Old 05-02-2003, 10:37 PM   #3
stodge
Member
 
Registered: Jan 2002
Posts: 52

Original Poster
Rep: Reputation: 15
It does find my public key on the server:

Quote:
debug1: Connection established.
debug1: identity file /home/mike/.ssh/identity type 0
debug1: identity file /home/mike/.ssh/id_rsa type -1
debug1: identity file /home/mike/.ssh/id_dsa type -1
The very last part of the debug output from the ssh login is:

Quote:
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: authentications that can continue: publickey,password
debug1: next auth method to try is publickey
debug1: try privkey: /home/mike/.ssh/id_rsa
debug1: try privkey: /home/mike/.ssh/id_dsa
debug1: next auth method to try is password
 
Old 05-14-2003, 12:59 PM   #4
sn9ke_eyes
Member
 
Registered: Feb 2003
Location: Texas
Distribution: slackware 11
Posts: 90

Rep: Reputation: 15
I was having the same problem, I did another ssh-keygen, and just left the key name to the default id_rsa and id_rsa.pub and now it just prompts me for the ssh passphrase, not my user password
 
Old 05-14-2003, 01:06 PM   #5
markus1982
Senior Member
 
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
Re: Help with SSH and public/private keys

Quote:
When I try to SSH into the server, it works except I have to enter my password, as though I were logging in through telnet etc.... I presume this means that the private/public key combination isn't being used.
This is wrong. You still need to enter your password so your encrypted private key can be decrypted ... if you need to enter username AND password though that's a different story.

I also use public key authentification since this is more secure and my /etc/ssh/sshd_config looks like:
Quote:
Port 22
AllowGroups users
AuthorizedKeysFile %h/.ssh/authorized_keys
#Banner /etc/ssh/banner
ChallengeResponseAuthentication no
ClientAliveInterval 15
ClientAliveCountMax 4
DenyGroups root
DenyUsers root
GatewayPorts no
HostbasedAuthentication no
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_rsa_key
IgnoreRhosts yes
IgnoreUserKnownHosts yes
KeepAlive no
KeyRegenerationInterval 900
ListenAddress 192.168.84.82
#LoginGraceTime 15
LoginGraceTime 30
LogLevel INFO
MaxStartups 5:50:100
PAMAuthenticationViaKbdInt no
PasswordAuthentication no
PermitEmptyPasswords no
PermitRootLogin no
PrintLastLog no
PrintMotd no
Protocol 2
PubkeyAuthentication yes
RhostsAuthentication no
RSAAuthentication no
ServerKeyBits 1024
StrictModes yes
Subsystem sftp /usr/lib/sftp-server
SyslogFacility AUTHPRIV
UseLogin no
UsePrivilegeSeparation yes
VerifyReverseMapping yes
X11Forwarding no
So it allows public key authentification only. The key needs to be stored in ~/.ssh/authorized_keys and the file should have 0600 permissions and nothing more.

I use putty to connect to the server. If you need more help just post!
 
Old 05-14-2003, 01:22 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Re: Re: Help with SSH and public/private keys

Quote:
Originally posted by markus1982
This is wrong. You still need to enter your password so your encrypted private key can be decrypted ... if you need to enter username AND password though that's a different story.
You shouldn't need to enter your password. Your passphrase yes but not your password.

If you want a passwordless login then try this:
1) login as USER on the client (where you want to connect from)
2) ssh-keygen -t dsa
(don't suppy a passphrase now - you can do that later once the first bit works)
3) scp /home/USER/.ssh/id_dsa.pub REMOTEHOST:/home/USER/.ssh/authorized_keys2
(you will need to enter your password this one time)
4) ssh REMOTEHOST
 
  


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
ssh public/private keys lord_darkhelmet Linux - Newbie 8 10-29-2005 03:14 PM
CVS & SSH & Public/private keys guideweb Linux - Software 15 09-09-2005 01:06 PM
SSH public / private keys problem guideweb Linux - Software 7 08-27-2005 09:49 PM
SSH public/private key authentication with GnuPG keys? thinksincode Linux - Security 1 02-25-2005 02:33 PM
How to delete public & private keys for SSH? TrulyTessa Linux - Security 2 11-18-2004 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:04 AM.

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
Open Source Consulting | Domain Registration