OS X Server 10.8.4 - ssh nur per publickey

S

Semmi

Aktives Mitglied
Thread Starter
Dabei seit
09.02.2010
Beiträge
530
Reaktionspunkte
23
Ich habe einen MBP und ein mini server mit jeweils 10.8.4

ich möchte nun auf den Server per ssh nur per publickey rauf kommen.

Ein Schlüsselpaar habe ich bereits auf meinem MBP erstellt und den pub auf den Server nach ~/.ssh/authorized_keys kopiert.

wie muss ich noch sshd_config auf dem Server konfigurieren, damit ich das gewünschte Ergebnis erreiche. Habe ich irgendwas vergessen?
 
du musst halt
PasswordAuthentication no
PubkeyAuthentication yes
machen...
 
dann spuckt mir ssh -v das hier aus und ich kann mich weiterhin per Passwort anmelden

Code:
OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/basti/.ssh/config
debug1: /Users/basti/.ssh/config line 1: Applying options for ses0
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ses0.local [192.168.1.151] port 22.
debug1: Connection established.
debug1: identity file /Users/basti/.ssh/id_rsa type 1
debug1: identity file /Users/basti/.ssh/id_rsa-cert type -1
debug1: identity file /Users/basti/.ssh/id_dsa type -1
debug1: identity file /Users/basti/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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: Server host key: RSA fb:57:6e:63:b7:d4:47:fe:9e:4a:b3:1e:29:3f:ad:32
debug1: Host 'ses0.local' is known and matches the RSA host key.
debug1: Found key in /Users/basti/.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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/basti/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/basti/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
 
hast du den sshd danach mal neu gestartet bzw dessen config neu laden lassen?
 
ja, ich habe ssh neugestartet, habe den mini auch mal neugestartet.

hier habe ich mal meine sshd_config. Eigentlich dürfte ich mich doch nicht mehr per Passwort anmelden dürfen, oder?

Code:
#	$OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# 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 override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile	.ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords both PasswordAuthentication and
# ChallengeResponseAuthentication must be set to "no".
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
# Also, PAM will deny null passwords by default.  If you need to allow
# null passwords, add the "	nullok" option to the end of the
# securityserver.so line in /etc/pam.d/sshd.
#UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# pass locale information
AcceptEnv LANG LC_*

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	/usr/libexec/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	ForceCommand cvs server
 
musst laut dem
Code:
# To disable tunneled clear text passwords both PasswordAuthentication and
# ChallengeResponseAuthentication must be set to "no".

wohl noch
ChallengeResponseAuthentication no
setzen...
 
ok, jetzt bin ich an dem Punkt, dass ich eine Permission denied bekomme.

unter ~/.ssh/authorized_keys liegt auf dem Server aber mein publickey…

Code:
OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /Users/basti/.ssh/config
debug1: /Users/basti/.ssh/config line 1: Applying options for ses0
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to ses0.local [192.168.1.151] port 22.
debug1: Connection established.
debug1: identity file /Users/basti/.ssh/id_rsa type 1
debug1: identity file /Users/basti/.ssh/id_rsa-cert type -1
debug1: identity file /Users/basti/.ssh/id_dsa type -1
debug1: identity file /Users/basti/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9
debug1: match: OpenSSH_5.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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: Server host key: RSA fb:57:6e:63:b7:d4:47:fe:9e:4a:b3:1e:29:3f:ad:32
debug1: Host 'ses0.local' is known and matches the RSA host key.
debug1: Found key in /Users/basti/.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: Offering RSA public key: /Users/basti/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/basti/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
 
Das Passwort von deinem Auth-key hast Du schon verwendet?

Gruß

win2mac
 
Das Passwort von deinem Auth-key hast Du schon verwendet?

Gruß

win2mac

ich bin der Meinung ja. Eine entsprechende Anfrage sollte doch eigentlich kommen, wenn das noch nicht passiert ist, oder?
 
du scheinst nur einen RSA key type 1 zu haben
Code:
debug1: identity file /Users/basti/.ssh/id_rsa type 1

vielleicht fehlt:
RSAAuthentication yes

oder der key ist zu kurz für protocol 2.
mach dir doch mal lieber einen DSA key oder einen RSA key type 2 ...
 
du scheinst nur einen RSA key type 1 zu haben
Code:
debug1: identity file /Users/basti/.ssh/id_rsa type 1

vielleicht fehlt:
RSAAuthentication yes

oder der key ist zu kurz für protocol 2.
mach dir doch mal lieber einen DSA key oder einen RSA key type 2 ...

ich bin der Meinung, dass lief sogar mal… kann mir nicht vorstellen, dass es am RSA key liegt. protocol 2 und RSAAuthentication yes sind ja default
 
der nimmt den ja nicht an:
Code:
debug1: Offering RSA public key: /Users/basti/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/basti/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive

RSAAuthentication ist wohl auch nur für protocol 1 eine option und das ist ja eh nicht aktiviert.

wie lang ist der key denn?

sshd enforces a minimum RSA key modulus size for protocol 1 and protocol 2 keys of 768 bits.
 
wie gesagt, ich glaube das mit der key länge ist es nicht. Der Key funktioniert bei github und bei einem anderen OS X Server 10.8. Habe jetzt von diesem Server mal die ssd_config genommen und auf meinen mini kopiert. Aber es funktioniert immer noch nicht! Kann man noch irgendwo was für ssh verstellen?
 
ich habe die Lösung gefunden. Auf dem Mac Server waren die Permissons kaputt - läuft jetzt alles
 
Zurück
Oben Unten