Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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