ssh Verbindung schließt sofort

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
Benutzeravatar
habakug
Moderator
Beiträge: 4313
Registriert: 23.10.2004 13:08:41
Lizenz eigener Beiträge: MIT Lizenz

Re: ssh Verbindung schließt sofort

Beitrag von habakug » 08.09.2020 16:50:32

Hallo,

vielleicht mal ssh so aufrufen:

Code: Alles auswählen

# ssh -vvv [...]

Gruss, habakug
( # = root | $ = user | !! = mod ) (Vor der PN) (Debianforum-Wiki) (NoPaste)

Ozelot
Beiträge: 1507
Registriert: 18.11.2007 09:52:58

Re: ssh Verbindung schließt sofort

Beitrag von Ozelot » 08.09.2020 16:57:30

Ah, danke. Hier die Ausgabe ab der Eingabe des Passwortes.

Code: Alles auswählen

xxxxxx@192.168.1.32's password: 
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.32 ([192.168.1.32]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
packet_write_wait: Connection to 192.168.1.32 port 22: Broken pipe

Benutzeravatar
habakug
Moderator
Beiträge: 4313
Registriert: 23.10.2004 13:08:41
Lizenz eigener Beiträge: MIT Lizenz

Re: ssh Verbindung schließt sofort

Beitrag von habakug » 08.09.2020 17:39:09

Hallo,

beende den SSH-"Server" und starte ihn manuell in der Konsole:

Code: Alles auswählen

# /usr/bin/sshd -ddd
Dann verbindest du dich von dem Client mit

Code: Alles auswählen

ssh -vvv [...]
.
Kann der SSH-User sich auf dem Server anmelden und in sein Home-Verzeichnis?

Gruss, habakug
( # = root | $ = user | !! = mod ) (Vor der PN) (Debianforum-Wiki) (NoPaste)

mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: ssh Verbindung schließt sofort

Beitrag von mat6937 » 08.09.2020 20:32:52

Ozelot hat geschrieben: ↑ zum Beitrag ↑
08.09.2020 15:44:25
Gemacht. Das Problem besteht leider weiterhin.
Schau mal mit:

Code: Alles auswählen

tcpdump -c 300 -vvveni any port 22
auf dem Server, ob der ssh-Anmeldetraffic des ssh-Clienten dort ankommt.
Wie ist auf dem ssh-Client, die Ausgabe von:

Code: Alles auswählen

echo $SHELL
? Oder mit "chsh" schauen, welche Login-Shell auf dem Client konfiguriert ist.

Ozelot
Beiträge: 1507
Registriert: 18.11.2007 09:52:58

Re: ssh Verbindung schließt sofort

Beitrag von Ozelot » 09.09.2020 06:31:22

@habakug:

Manueller Start funktioniert leider nicht:

Code: Alles auswählen

Missing privilege separation directory: /run/sshd
Ich starte normalerweise mit "systemctl start sshd". Kann ich damit auch die entsprechende Option übergeben?

@mat6937:

Die shell ist überall bash.

mit tcpdump sehe ich einen Austausch von Paketen zwischen den beiden fraglichen IP Adressen auf port 22 (und 44668). Brauchst Du es spezifischer?



Kleine Merkwürdigkeit: Ich bekomme jetzt nicht mehr "broken pipe" sondern

Code: Alles auswählen

Connection to 192.168.1.32 closed by remote host.
Connection to 192.168.1.32 closed.

mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: ssh Verbindung schließt sofort

Beitrag von mat6937 » 09.09.2020 17:25:19

Ozelot hat geschrieben: ↑ zum Beitrag ↑
09.09.2020 06:31:22
mit tcpdump sehe ich einen Austausch von Paketen zwischen den beiden fraglichen IP Adressen auf port 22 (und 44668). Brauchst Du es spezifischer?
Ja, damit man sieht welche Flags in den Paketen sind bzw. ob das letzte Paket vom ssh-Client oder vom Server kommt.

Ozelot hat geschrieben: ↑ zum Beitrag ↑
09.09.2020 06:31:22
Kleine Merkwürdigkeit: Ich bekomme jetzt nicht mehr "broken pipe" ...
Versuch mal auch mit:

Code: Alles auswählen

UsePAM no
in der sshd_config vom Server.

Ozelot
Beiträge: 1507
Registriert: 18.11.2007 09:52:58

Re: ssh Verbindung schließt sofort

Beitrag von Ozelot » 10.09.2020 05:29:25

Auch ohne PAM kein Erfolg.

Hier der ganze tcpdump, letztes Paket kommt vom Server:

Code: Alles auswählen

12:32:45.149816  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 76: (tos 0x0, ttl 64, id 7023, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [S], cksum 0xc904 (correct), seq 2448995266, win 64240, options [mss 1460,sackOK,TS val 1511371258 ecr 0,nop,wscale 7], length 0
12:32:45.149863 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 76: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [S.], cksum 0xd808 (correct), seq 2149562392, ack 2448995267, win 65160, options [mss 1460,sackOK,TS val 1400201637 ecr 1511371258,nop,wscale 7], length 0
12:32:45.152952  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7024, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0x0304 (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 1511371358 ecr 1400201637], length 0
12:32:45.153005  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 109: (tos 0x0, ttl 64, id 7025, offset 0, flags [DF], proto TCP (6), length 93)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0x79f4 (correct), seq 1:42, ack 1, win 502, options [nop,nop,TS val 1511371358 ecr 1400201637], length 41
12:32:45.153028 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25642, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [.], cksum 0x02d1 (correct), seq 1, ack 42, win 509, options [nop,nop,TS val 1400201640 ecr 1511371358], length 0
12:32:45.162614 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 109: (tos 0x0, ttl 64, id 25643, offset 0, flags [DF], proto TCP (6), length 93)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0x79b7 (correct), seq 1:42, ack 42, win 509, options [nop,nop,TS val 1400201650 ecr 1511371358], length 41
12:32:45.164559  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7026, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0x0299 (correct), seq 42, ack 42, win 502, options [nop,nop,TS val 1511371370 ecr 1400201650], length 0
12:32:45.164568 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 1148: (tos 0x0, ttl 64, id 25644, offset 0, flags [DF], proto TCP (6), length 1132)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0x2121 (correct), seq 42:1122, ack 42, win 509, options [nop,nop,TS val 1400201652 ecr 1511371370], length 1080
12:32:45.168200  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 1460: (tos 0x0, ttl 64, id 7027, offset 0, flags [DF], proto TCP (6), length 1444)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0x8ecd (correct), seq 42:1434, ack 42, win 502, options [nop,nop,TS val 1511371371 ecr 1400201650], length 1392
12:32:45.213243  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7028, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0xf8be (correct), seq 1434, ack 1122, win 501, options [nop,nop,TS val 1511371419 ecr 1400201652], length 0
12:32:45.213279 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25645, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [.], cksum 0xf8bd (correct), seq 1122, ack 1434, win 501, options [nop,nop,TS val 1400201701 ecr 1511371371], length 0
12:32:45.215750  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 116: (tos 0x0, ttl 64, id 7029, offset 0, flags [DF], proto TCP (6), length 100)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0xd88b (correct), seq 1434:1482, ack 1122, win 501, options [nop,nop,TS val 1511371421 ecr 1400201701], length 48
12:32:45.223385 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 520: (tos 0x0, ttl 64, id 25646, offset 0, flags [DF], proto TCP (6), length 504)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0x2521 (correct), seq 1122:1574, ack 1482, win 501, options [nop,nop,TS val 1400201711 ecr 1511371421], length 452
12:32:45.225174  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7030, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0xf686 (correct), seq 1482, ack 1574, win 498, options [nop,nop,TS val 1511371431 ecr 1400201711], length 0
12:32:45.233260  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 84: (tos 0x0, ttl 64, id 7031, offset 0, flags [DF], proto TCP (6), length 68)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0xec42 (correct), seq 1482:1498, ack 1574, win 501, options [nop,nop,TS val 1511371439 ecr 1400201711], length 16
12:32:45.278716 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25647, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [.], cksum 0xf634 (correct), seq 1574, ack 1498, win 501, options [nop,nop,TS val 1400201766 ecr 1511371439], length 0
12:32:45.280980  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 112: (tos 0x0, ttl 64, id 7032, offset 0, flags [DF], proto TCP (6), length 96)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0x36ea (correct), seq 1498:1542, ack 1574, win 501, options [nop,nop,TS val 1511371486 ecr 1400201766], length 44
12:32:45.281005 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25648, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [.], cksum 0xf5d7 (correct), seq 1574, ack 1542, win 501, options [nop,nop,TS val 1400201768 ecr 1511371486], length 0
12:32:45.281180 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 112: (tos 0x0, ttl 64, id 25649, offset 0, flags [DF], proto TCP (6), length 96)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0x76c0 (correct), seq 1574:1618, ack 1542, win 501, options [nop,nop,TS val 1400201768 ecr 1511371486], length 44
12:32:45.282889  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 128: (tos 0x0, ttl 64, id 7033, offset 0, flags [DF], proto TCP (6), length 112)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0xed11 (correct), seq 1542:1602, ack 1618, win 501, options [nop,nop,TS val 1511371489 ecr 1400201768], length 60
12:32:45.289825 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 120: (tos 0x0, ttl 64, id 25650, offset 0, flags [DF], proto TCP (6), length 104)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0xc114 (correct), seq 1618:1670, ack 1602, win 501, options [nop,nop,TS val 1400201777 ecr 1511371489], length 52
12:32:45.333481  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7034, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0xf4fd (correct), seq 1602, ack 1670, win 501, options [nop,nop,TS val 1511371539 ecr 1400201777], length 0
12:32:49.143534  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 152: (tos 0x0, ttl 64, id 7035, offset 0, flags [DF], proto TCP (6), length 136)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0x2091 (correct), seq 1602:1686, ack 1670, win 501, options [nop,nop,TS val 1511375252 ecr 1400201777], length 84
12:32:49.157227 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 96: (tos 0x0, ttl 64, id 25651, offset 0, flags [DF], proto TCP (6), length 80)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [P.], cksum 0x9298 (correct), seq 1670:1698, ack 1686, win 501, options [nop,nop,TS val 1400205644 ecr 1511375252], length 28
12:32:49.175189 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25652, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [F.], cksum 0xd6de (correct), seq 1698, ack 1686, win 501, options [nop,nop,TS val 1400205662 ecr 1511375252], length 0
12:32:49.214652 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25653, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [F.], cksum 0xd6b6 (correct), seq 1698, ack 1686, win 501, options [nop,nop,TS val 1400205702 ecr 1511375252], length 0
12:32:49.250194  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7036, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0xd626 (correct), seq 1686, ack 1698, win 501, options [nop,nop,TS val 1511375455 ecr 1400205644], length 0
12:32:49.250213  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 80: (tos 0x0, ttl 64, id 7037, offset 0, flags [DF], proto TCP (6), length 64)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [.], cksum 0x221f (correct), seq 1686, ack 1699, win 501, options [nop,nop,TS val 1511375455 ecr 1400205702,nop,nop,sack 1 {1698:1699}], length 0
12:32:49.250229  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 240: (tos 0x0, ttl 64, id 7038, offset 0, flags [DF], proto TCP (6), length 224)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [P.], cksum 0xb578 (correct), seq 1686:1858, ack 1699, win 501, options [nop,nop,TS val 1511375455 ecr 1400205702], length 172
12:32:49.250251 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 56: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [R], cksum 0x3ec6 (correct), seq 2149564091, win 0, length 0
12:32:49.250264  In yy:yy:yy:yy:yy:yy ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 7039, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.60.44668 > 192.168.1.32.22: Flags [F.], cksum 0xd53e (correct), seq 1858, ack 1699, win 501, options [nop,nop,TS val 1511375455 ecr 1400205702], length 0
12:32:49.250269 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 56: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [R], cksum 0x3ec6 (correct), seq 2149564091, win 0, length 0


mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: ssh Verbindung schließt sofort

Beitrag von mat6937 » 10.09.2020 09:32:05

Ozelot hat geschrieben: ↑ zum Beitrag ↑
10.09.2020 05:29:25

Code: Alles auswählen

12:32:49.175189 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25652, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [F.], cksum 0xd6de (correct), seq 1698, ack 1686, win 501, options [nop,nop,TS val 1400205662 ecr 1511375252], length 0
    
12:32:49.214652 Out xx:xx:xx:xx:xx:xx ethertype IPv4 (0x0800), length 68: (tos 0x0, ttl 64, id 25653, offset 0, flags [DF], proto TCP (6), length 52)
    192.168.1.32.22 > 192.168.1.60.44668: Flags [F.], cksum 0xd6b6 (correct), seq 1698, ack 1686, win 501, options [nop,nop,TS val 1400205702 ecr 1511375252], length 0
Versuch mal statt der "password authentication", mit pub-key.

Ozelot
Beiträge: 1507
Registriert: 18.11.2007 09:52:58

Re: ssh Verbindung schließt sofort

Beitrag von Ozelot » 18.09.2020 05:25:49

Tada - Endlich!

Lösung: Ich kann zwar aus irgendeinem Grund den sshd nicht aus der Konsole starten (s.o.), aber ich kann ihm ein

Code: Alles auswählen

LogLevel DEBUG3
in der /etc/ssh/sshd_config mitgeben. Damit sah man ein

Code: Alles auswählen

fatal: bad ownership or modes for chroot directory component "/xxx/"
was daran lag, daß die Rechte im chroot-Verheichnis auf 777 standen. Ein chmod 755 später funktionierte alles.

Danke allen-

dirk11
Beiträge: 2818
Registriert: 02.07.2013 11:47:01

Re: ssh Verbindung schließt sofort

Beitrag von dirk11 » 19.09.2020 20:31:00

Super! :THX:

Antworten