Posts Tagged ‘GNU/Linux’

Donnerstag, 28. März 2024

Debian Bookworm: scp meldet „Connection closed“

Ich plane, hier einige Blog-Artikel zum Upgrade meiner Debian Bullseye-Server auf Bookworm und dabei aufgetretenen Problemen zu veröffentlichen.

Erstes Problem: Ein Cron Job, der jede Stunde ein bash-Script aufruft, lief nach dem Upgrade nicht mehr durch.

Die Fehlermeldung:

...
/usr/bin/scp: Connection closed

Auf dem Server (dem Zielsystem) wurde folgendes geloggt:

Mar 26 01:00:15 SERVER sshd[1090765]: Connection from 10.10.10.19 port 33968 on 10.10.10.102 port 22 rdomain ""
Mar 26 01:00:15 SERVER sshd[1090765]: Accepted key RSA SHA256:X found at /home/cronbackup/.ssh/authorized_keys:1
Mar 26 01:00:15 SERVER sshd[1090765]: Postponed publickey for cronbackup from 10.10.10.19 port 33968 ssh2 [preauth]
Mar 26 01:00:16 SERVER sshd[1090765]: Accepted key RSA SHA256:X found at /home/cronbackup/.ssh/authorized_keys:1
Mar 26 01:00:16 SERVER sshd[1090765]: Accepted publickey for cronbackup from 10.10.10.19 port 33968 ssh2: RSA SHA256:X
Mar 26 01:00:16 SERVER sshd[1090765]: pam_unix(sshd:session): session opened for user cronbackup(uid=1001) by (uid=0)
Mar 26 01:00:16 SERVER systemd-logind[630]: New session 1240768 of user cronbackup.
Mar 26 01:00:16 SERVER systemd: pam_unix(systemd-user:session): session opened for user cronbackup(uid=1001) by (uid=0)
Mar 26 01:00:16 SERVER sshd[1090765]: pam_tty_audit(sshd:session): changed status from 0 to 1
Mar 26 01:00:16 SERVER sshd[1090765]: User child is on pid 1090789
Mar 26 01:00:16 SERVER sshd[1090789]: Starting session: subsystem 'sftp' for cronbackup from 10.10.10.19 port 33968 id 0
Mar 26 01:00:16 SERVER sshd[1090789]: Close session: user cronbackup from 10.10.10.19 port 33968 id 0
Mar 26 01:00:16 SERVER sshd[1090789]: Received disconnect from 10.10.10.19 port 33968:11: disconnected by user
Mar 26 01:00:16 SERVER sshd[1090789]: Disconnected from user cronbackup 10.10.10.19 port 33968
Mar 26 01:00:16 SERVER sshd[1090765]: pam_unix(sshd:session): session closed for user cronbackup
Mar 26 01:00:16 SERVER sshd[1090765]: pam_tty_audit(sshd:session): restored status to 0
Mar 26 01:00:16 SERVER systemd-logind[630]: Session 1240768 logged out. Waiting for processes to exit.
Mar 26 01:00:16 SERVER systemd-logind[630]: Removed session 1240768.

Nach etwas Googlen dann die Lösung:

Note: Since OpenSSH 8.8 the scp utility uses the SFTP protocol by default. The -O option must be used to use the legacy SCP protocol.

Quelle: ssh working on all devices but scp from some devices gives „Connection closed“ error

Seit ich im bash-Script das Argument -O ergänzt habe, läuft der Cron Job wieder durch.

Tags: , , , , ,
Labels: Uncategorized

2 Kommentare | neuen Kommentar verfassen