3

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.

2

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.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.