enrixk
Goto Top

OpenSSH auf Windows 10 - Nichts klappt auf anhieb

Hallo,

ich hab' mal 'ne Frage. Und zwar habe ich so 'ne kleine Active Directory Domäne (mit Samba) aufgesetzt; nur eine Spielwiese, keine Panik.

In dem Netzwerk befinden sich zwei Win 10 Clients, nennen wir sie PC A und PC B. Auf dem einen (PC A) habe ich OpenSSH-Server installiert. Über den anderen (PC B) wollte ich mich via Powershell und ssh mit PC A verbinden.

Nun gibt es zwei Probleme:

1. Ich bekomme auf dem SSH-Client (PC B) die Fehlermeldung
Permission denied (publickey)
. Das finde ich insofern seltsam, als dass ich
#PubkeyAuthentication yes
auskommentiert habe in der sshd_config.

2. Wenn auf PC A niemand eingeloggt ist, scheitert der Verbindungsaufbau an einem Timeout. Sieht danach aus, als würde der OpenSSH-Dienst erst nach dem Login starten. Muss man denn OpenSSH tatsächlich als Dienst erst noch entsprechend konfigurieren? Ich hätte vermutet, dass das automatisch bei Installation so eingestellt ist, dass der Server beim Systemstart startet.

Ich poste mal meine sshd_config. Vielleicht kann da mal jemand drüber schauen und weiß einen Rat.

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

# 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 ::

#HostKey __PROGRAMDATA__/ssh/ssh_host_rsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_dsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ecdsa_key
#HostKey __PROGRAMDATA__/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#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

#AuthorizedPrincipalsFile none

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

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

# GSSAPI options
#GSSAPIAuthentication no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem	sftp	sftp-server.exe

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server

Match Group administrators
       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

Content-Key: 4149076526

Url: https://administrator.de/contentid/4149076526

Printed on: April 24, 2024 at 15:04 o'clock

Mitglied: 4091525239
Solution 4091525239 Oct 04, 2022 updated at 16:15:26 (UTC)
Goto Top
#PubkeyAuthentication yes
Default ist "yes", wenn du auskommentierst bleibt es bei "yes" weil das der Default unter Windows ist face-wink. Willst du es deaktivieren musst du es einkommentieren und auf "no" setzen. Works as designed face-smile.
Wenn du dann noch beim Client nen id_rsa key im .ssh Ordner hast und der User auf dem Remote-System ein Administrator ist und pukey auth am client an ist , machts peng, wenn der public key nicht auf dem Zielsystem hinterlegt ist.
Wenn auf PC A niemand eingeloggt ist, scheitert der Verbindungsaufbau an einem Timeout. Sieht danach aus, als würde der OpenSSH-Dienst erst nach dem Login starten.
Muss man denn OpenSSH tatsächlich als Dienst erst noch entsprechend konfigurieren? Ich hätte vermutet, dass das automatisch bei Installation so eingestellt ist, dass der Server beim Systemstart startet.
Geh in die Dienste-Konfiguration und schau nach ob der Dienst auf verzögerten Start eingestellt ist, wenn ja stelle in auf Automatisch.

screenshot
Member: Enrixk
Enrixk Oct 04, 2022 at 17:31:41 (UTC)
Goto Top
Vielen vielen Dank.

Nur eine kurze Nachfrage. Ie kann ich clientseitig public key deaktivieren?
Mitglied: 4091525239
4091525239 Oct 04, 2022 at 19:20:30 (UTC)
Goto Top
Werfe sämtliche Keys aus dem .ssh Verzeichnis des Clients.
Member: Enrixk
Enrixk Oct 05, 2022 at 06:55:22 (UTC)
Goto Top
Ich bräuchte doch nochmal einen Rat. Ich kann mir vorstellen, dass man in der sshd_config oder clientseitig beim Verbindungsaufbau in der Powershell die Domäne angeben muss, in der sich die Benutzer befinden.

Ich habe bisher beim Verbindungsaufbau auf dem Client folgendes eingegeben:

ssh domain\Benutzername@192.168.33.63 

Danach erscheint nun dankenswerterweise eine Passworteingabe. Wenn ich nun das Passwort eingeben erscheint ständig die Meldung
Permission denied, please try again.
.
Mitglied: 4091525239
4091525239 Oct 05, 2022 at 07:01:33 (UTC)
Goto Top