LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   RSA authentication in OpenSSH (https://www.linuxquestions.org/questions/linux-software-2/rsa-authentication-in-openssh-893452/)

angol 07-24-2011 09:09 AM

RSA authentication in OpenSSH
 
Hello !!!!!

Tune the connection to ssh using public key, but somehow - it does not work on it to connect.
What I did:

1. Created a public and private key
2. Public copied to the authorized_keys file and transfer to the private car, which will connect
3. Transform our private key in the key supported Putty.
4. Then I go through Putty enter your login and instead, that would connect to a public key to enter the password login

Give you the config file ..... might be in it what - a mistake

Code:


#      $OpenBSD: sshd_config,v 1.81 2009/10/08 14:03:41 markus Exp $
 
# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.
 
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
 
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.
 
 
Port 22
Protocol 2
 
# Ключ сервера для протокола версии 1
HostKey /etc/ssh/ssh_host_key
# Ключи rsa и dsa для ssh версии 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
 
KeyRegenerationInterval 3600
ServerKeyBits 1024
 
LoginGraceTime 600
PermitRootLogin yes
StrictModes yes
 
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
 
 
#RhostsAuthentication no
RhostsRSAAuthentication no
#IgnoreHosts yes
IgnoreRhosts yes
HostbasedAuthentication no
IgnoreUserKnownHosts no
UseLogin yes
PasswordAuthentication yes
PermitEmptyPasswords no
UsePAM yes
 
X11Forwarding no
#X11UseLocalhost yes
PrintMotd yes
PrintLastLog yes
#KeepAlive yes
MaxStartups 10
 
Subsystem sftp /usr/lib/ssh/sftp-server


acid_kewpie 07-24-2011 09:38 AM

on the Linux side, the most common problem is permissions on the files. ~/.ssh should be set 700, and the authorized_keys file set as 600. These are explicitly checked by ssh by default and it will refuse to use them if not managed securely enough.

angol 07-24-2011 09:50 AM

Quote:

Originally Posted by acid_kewpie (Post 4423871)
on the Linux side, the most common problem is permissions on the files. ~/.ssh should be set 700, and the authorized_keys file set as 600. These are explicitly checked by ssh by default and it will refuse to use them if not managed securely enough.

law established
chmod 600 authorized_keys
chmod 700 ~/.ssh/
but emerged a new error - Permission denied ()

angol 07-24-2011 11:11 AM

Has executed the following command ssh-v-i ~/.ssh/id_rsa 192.168.10.1

And here that has received

Code:



ssh -v -i ~/.ssh/id_rsa 192.168.10.1
OpenSSH_5.5p1, OpenSSL 1.0.0a-fips 1 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Applying options for *
debug1: Connecting to 192.168.10.1 [192.168.10.1] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5
debug1: match: OpenSSH_5.5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.10.1' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/root/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/root/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).


acid_kewpie 07-24-2011 11:23 AM

you need to look at the server side logs, not the client.


All times are GMT -5. The time now is 06:03 PM.