0

I change this file ~/.ssh/authorized_keys in remote server, shown below, and want to run a script when ssh to it. #Flyakite command="/home/path/to/script" ssh-rsa my-key

now if I run ssh $USER@$HOST x1 x2 x3, it works fine, however, if I run scp path/to/file $USER@$HOST:path/to/file, it does not work...

what is the problem? How can I make it work?

migrated from stackoverflow.com Nov 5 '12 at 13:56

This question came from our site for professional and enthusiast programmers.

  • " it does not work..." -- because the file(s) you copied aren't present on the target, but there was no error message? Or there was an error message that you need help understanding? – Brian Cain Nov 5 '12 at 4:07
  • @BrianCain, there is no error message. "are not present on the target?" I am not quite understand about it, could you explain it? – Flyakite Nov 5 '12 at 4:48
1

for that particular key, add "command=" to the key, means cannot run anything else other than that script, it has limited access to that server.

0

Internally, scp works by executing a command on the server. But if you force your target system to execute a different command, scp cannot work any longer.

You could put a script on the target host which recognizes an scp command and executes it, and if none is recognized, your "default" program is invoked instead.

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.