Thursday, October 3, 2013

ssh hopscotch

hot damn my job is fun.
me on system1 is pubkeyed on system2, but not system3.
toor on system2 is pubkeyed on system3.
me needs to run something on system3
ssh magic!

me@system1:~$ ssh toor@system2 "ssh notme@system3 \"ls -la ~\""
and here's a real world example of the excitement from a correspondent we shall call dr. excitement...
scp %1*
ssh "ssh \"sudo service tomcat7 stop;sudo rm -v /var/lib/tomcat7/webapps/somethingneat.war\""
ssh "scp %1.war"
ssh "ssh \"sudo cp -v ~/%1.war /var/lib/tomcat7/webapps/somethingneat.war; sudo chown -v tomcat7 /var/lib/tomcat7/webapps/somethingneat.war; sudo service tomcat7 start\""
echo woo\!
Post a Comment