LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Help with SSH and public/private keys (https://www.linuxquestions.org/questions/linux-security-4/help-with-ssh-and-public-private-keys-57869/)

stodge 05-02-2003 03:41 PM

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

tyler_durden 05-02-2003 09:57 PM

try running ssh with the -v option, i have found this to be helpfull in debuging authentication issues

stodge 05-02-2003 10:37 PM

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

sn9ke_eyes 05-14-2003 12:59 PM

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

markus1982 05-14-2003 01:06 PM

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!

david_ross 05-14-2003 01:22 PM

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


All times are GMT -5. The time now is 07:35 AM.