I have server2 with an file "/home/test.tar.gz". On server1 i want to execute command via ssh to extract test.tar.gz to local directory.
Something like:
sshpass -p 'password' ssh root@server2 "tar zxf /home/test.tar.gz" > /home/try
Is this even possible?
1st you should run ssh-copy-id or manually copy your ssh public key and share your server1 key to server2 and setup access without password.
follow below site :
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/
then use below command to unzip file using ssh