I am facing issue while executing a remote command. If I execute command by logging into remote machine, it works. But if I execute same command from my laptop to remote machine it returns different status code.
Local execution on 192.168.0.166:
root@monica-E470:~# virsh list --state-shutoff | grep Qcow2 | wc -l
1
Remote Command execution:
root@sandipd-ThinkPad-E450:~# ssh [email protected] 'virsh list --state-shutoff | grep Qcow2 | wc -l'
[email protected]'s password:
0
I have tried with different scenarios, but no luck. Has anyone faced same issue?
ssh [email protected] virsh list --state=shutoff | grep -Fc Qcow2? (Replacinggrep | wc -lwithgrep -cis just an optimization, not really the beef here -- the main thing is to run thegreplocally, as there is no reason to run it asrooton the remote server.)| cat? I'm guessing there will be no output fromvirsh listbut I have no idea why.virshbut are there any environment variables set in the local session that are not there when you ssh? You can compare with the output ofenvin both cases.