What is the proper way to do something like this:

diff <( ssh -t myuser@hosta 'sudo httpd -M') <(httpd -M)

When I want to compare the output of the 2 commands, the first on a remote host the second local?

Is this the proper method?

  • 1
    That looks fine. What problems are you having with it?
    – Mat
    Dec 5 '13 at 17:21
  • No problems per se, I was just wondering if using process substitution had any ramifications in regard to ssh. Dec 5 '13 at 17:36
  • None, ssh is just a process, like any other.
    – terdon
    Dec 5 '13 at 17:39
  • This is exactly the way to do it.
    – slm
    Dec 5 '13 at 18:26

first you have to set public key base authentication in between both server. how you can set both server public key base auth:

NOTE:- Enter all commands on local server

first generate ssh key:


then set that key for authenticate remote server:

ssh-copy-id -i ~/.ssh/id_rsa.pub root@remote_server_address

after done all this check that public key is working proper or not :

ssh root@remote_server_address

if no password promt for login, i mean without password if you can login then ssh key is working proper.

now use your command local server :

diff <( ssh -t myuser@hosta 'sudo echo "test1"') <(echo "test2")

Now your command will show you proper output ...

  • The -t flag seems to prevent this from working, as of OpenSSH 7.3 Feb 23 '17 at 15:28

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.