Sample Header Ad - 728x90

SCP launches the SSH sub process with "-oPermitLocalCommand=no" - how to change this?

2 votes
0 answers
118 views
I have in my SSH
~/.ssh/config
the following configuration:
Host *
     # note: this needs in /etc/ssh/ssh_config:  PermitLocalCommand yes
     #
     LocalCommand gpgconf --reload scdaemon
The reason for this is, the private RSA key for the SSH connection comes from an OpenPGP smartcard which is requesting a PIN to give access and the card should be resetted with the above command after providing the key. This works fine for SSH, but not for SCP. SCP launches the required SSH command with an option
"-oPermitLocalCommand=no"
which disables this feature. One can see this nicely with:
strace -f -o scp.tr scp "-oPermitLocalCommand=yes" foo www.unixarea.de:.
...
grep execv scp.tr
10205 execve("/usr/bin/scp", ["scp", "-oPermitLocalCommand=yes", "foo",
"www.unixarea.de"...], 0xffffdf2147a0 /* 32 vars */) = 0
10206 execve("/usr/bin/ssh", ["/usr/bin/ssh", "-x", "-oPermitLocalCommand=no",
"-oClearAllForwardings=yes", "-oRemoteCommand=none", "-oRequestTTY=no", "-o",
"PermitLocalCommand=yes", "-oForwardAgent=no", "-l", "XXXXXXXXXXXXXXXX", "--",
"www.unixarea.de", "scp -t ."], 0xffffe38c6780 /* 32 vars */) = 0
and so the card remains active and provides keys without PIN entry. This is on some Debian version of Linux, PureOS:
purism@pureos:~$ ssh -V
OpenSSH_8.4p1 Debian-5+deb11u3, OpenSSL 1.1.1w  11 Sep 2023
How could this be changed?
Asked by Matthias Apitz (31 rep)
May 3, 2024, 09:31 AM
Last activity: Mar 19, 2025, 04:28 PM