Auf dem lokalen Host kann kein passwortloses SSH eingerichtet werden

Auf dem lokalen Host kann kein passwortloses SSH eingerichtet werden

Ich habe alle im Folgenden angegebenen Schritte befolgtAntwort-

1. ssh-keygen -t rsa
Press enter for each line 
2. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
3. chmod og-wx ~/.ssh/authorized_keys 

Ich habe auch versuchtDas-

This can be accomplished with the NoHostAuthenticationForLocalhost option, either used on the command line with -o NoHostAuthenticationForLocalhost or by inserting NoHostAuthenticationForLocalhost yes into ~/.ssh/config.

Alle meine Berechtigungen sind korrekt eingestellt, d. h. -

-rw-r--r--. 1 user user 1537 Feb 17 17:47 authorized_keys
-rw-r--r--. 1 user user 1537 Feb 17 17:47 authorized_keys~
-rw-r--r--. 1 user user  175 Oct 14 16:04 config
-rw-------. 1 user user 1743 Feb 17 17:44 id_rsa
-rw-r--r--. 1 user user  399 Feb 17 17:44 id_rsa.pub
-rw-r--r--. 1 user user  739 Feb 17 17:41 id_rsa.pub~
-rw-r--r--. 1 user user 4803 Feb 10 10:52 known_hosts
-rw-r--r--. 1 user user 4397 Feb 10 10:52 known_hosts~
-rw-------. 1 user user 4803 Feb 10 10:31 known_hosts.old

Berechtigungen von .ssh -

drwx------.  2 user user    4096 Feb 17 17:47 .ssh

Wenn Sie dies tun sudo /usr/sbin/sshd -d, erhalten Sie Folgendes:

debug1: sshd version OpenSSH_5.3p1
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
debug1: Bind to port 22 on ::.
Bind to port 22 on :: failed: Address already in use.
Cannot bind any address.

Ausgabe von ssh -v localhost

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/qubole/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/qubole/.ssh/identity type -1
debug1: identity file /home/qubole/.ssh/identity-cert type -1
debug1: identity file /home/qubole/.ssh/id_rsa type 1
debug1: identity file /home/qubole/.ssh/id_rsa-cert type -1
debug1: identity file /home/qubole/.ssh/id_dsa type -1
debug1: identity file /home/qubole/.ssh/id_dsa-cert type -1
debug1: identity file /home/qubole/.ssh/id_ecdsa type -1
debug1: identity file /home/qubole/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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: Forcing accepting of host key for loopback/localhost.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_502' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_502' not found

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_502' not found

debug1: Next authentication method: publickey
debug1: Offering public key: /home/qubole/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /home/qubole/.ssh/identity
debug1: Trying private key: /home/qubole/.ssh/id_dsa
debug1: Trying private key: /home/qubole/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Inhalt von ssh_config -

#   $OpenBSD: ssh_config,v 1.25 2009/02/17 01:28:32 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
Host *
    GSSAPIAuthentication yes
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
    ForwardX11Trusted yes
# Send locale-related environment variables
    SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
    SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
    SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    SendEnv XMODIFIERS

Ich kann immer noch keine SSH-Verbindung zu meinem lokalen Host herstellen, ohne ein Passwort einzugeben. Wie richte ich eine SSH-Verbindung zu meinem lokalen Host ohne Passwort ein?

Antwort1

Die authorized keysDateiberechtigungen sollten nicht niedriger als 600 und die .sshVerzeichnisberechtigungen nicht niedriger als 700 sein. Alles, was höher als dieser Wert ist, wird Probleme bereiten.

verwandte Informationen