A behavioral change in the version of SCP in RHEL9

Latest response

RHEL9 uses a version of OpenSSH that has deprecated the SCP protocol. Details are here: https://www.redhat.com/en/blog/openssh-scp-deprecation-rhel-9-what-you-need-know?extIdCarryOver=true&sc_cid=701f2000001OH7JAAW

One difference I see is when scp'ing a file to the same machine, same directory, same name. In prior versions, the file would copy fine. In the newer version the file is truncated. Here, I first copy using the older protocol (-O), and then using the new, default protocol:

[testuser@redhat9-b5 tmp]$ echo "original file" > /tmp/file.txt
[testuser@redhat9-b5 tmp]$ scp -O /tmp/file.txt $(hostname):/tmp/file.txt
file.txt 100% 14 4.1KB/s 00:00
[testuser@redhat9-b5 tmp]$ cat /tmp/file.txt
original file
[testuser@redhat9-b5 tmp]$ scp /tmp/file.txt $(hostname):/tmp/file.txt
file.txt 0% 0 0.0KB/s --:-- ETA
[testuser@redhat9-b5 tmp]$ cat /tmp/file.txt
[testuser@redhat9-b5 tmp]$
[testuser@redhat9-b5 tmp]$ ls -l /tmp/file.txt
-rw-r--r--. 1 testuser testuser 0 Apr 12 14:19 /tmp/file.txt

Responses

Hello David,

Yes, observed the same here as well. So, by default the usage of "scp" command without "-O" parameter would use SFTP protocol which otherwise uses SCP. The usage of "scp" command be nullified by creating the file as root "/etc/ssh/disable_scp".

This is documented here.