I ran into this post that suggests adding the following to .ssh/authorized_keys in order to force an scp command :

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="scp -v -r -d -t ~/CONTENT" ssh-rsa AAAAMYRSAKEY...

The solution works great but I couldn't find any information about the -d and -t options in the scp manual. After some searching I managed to find another post that shed some light`:

scp -t is normally the receiving end of an scp transfer. It's launched by another scp instance which is going to send files to the receiving end. The sending scp instance starts the receiver, sends the C line to mark that a file is coming, then sends the data for the file.

Any idea what what effect the -d option has?

Also, out of curiosity, does anyone know if/where I could find an official description. I wasn't able to find anything in the source code.

1 Answer 1


The -d flag is a server flag like -t. In this case it means that the target should be a directory (versus a regular file) -- attempts to scp to a file instead of into a directory will be killed.

In the current OpenSSH source code, -d is caught here, sets the targetshouldbedirectory flag and then is checked here. If verifydir() is false, the (host-side) process is killed.

n.b. I could not find an official description but did find it in the source I've linked.

  • is this a openssh flag only? This has no mention in the man pages.
    – kyrlon
    Oct 9, 2023 at 16:42
  • 1
    That's the premise of the question: these are undocumented flags. I didn't look at any other SSH implementation. Oct 10, 2023 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .