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 want to embed a remote execution command in an SCP command. Is that possible?

It will save having to execute an SCP command first, then executing an SSH command on the transferred fiies.

Is this possible?

share|improve this question

2 Answers 2

Why do you want to avoid running scp followed by ssh? Is it because connecting is slow? If so you might want to try ssh multiplexing:

With multiplexing you can connect once, then any future ssh or scp commands will reuse the existing connection.

Here are some links that explain ssh multiplexing:

share|improve this answer

You might be better doing it the other way around - i.e. transferring the files as part of the ssh session, then executing the cmds as part of the same ssh.

See here : http://unix.stackexchange.com/questions/57807/copy-over-ssh-and-execute-commands-in-one-session

I really don't think scp has the capability you're after but you can 'emulate' the same result over ssh.

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.