ssh

ssh

  • Remote to remote copy:

    #!/bin/bash
    
    
    SRC=$(cut -d: -f1 <<<$1)
    SRC_DIR=$(cut -d: -f2 <<<$1)
    DEST=$(cut -d: -f1 <<<$2)
    DEST_DIR=$(cut -d: -f2<<<$2)
    
    
    #echo "Sync $SRC_DIR from $SRC to $DEST at $DEST_DIR"
    
    
    if [ $3 ] || !([ $SRC_DIR ] && [ $SRC ] && [ $DEST ] && [ $DEST_DIR ]) ;then
     echo -e "Sytax is EXACTLY:\n\n\t$0 <src>:<path> <dest>:<path>\n\nEverything else fails as you did right now."; exit 2
     fi
    
    
     ssh $SRC "tar cf - $SRC_DIR" | ssh $DEST "tar xfv - -C $DEST_DIR"
    
  • Use a ssh hop Best used in ~/.ssh/config:

    Host                FarEnd
    User                yakindsir
    HostName            far.away.host.com
    ProxyCommand    ssh -W%h:%p yakindsir@gateway.to.far.away.com
    

    Can be stacked

    Host                FarFarAway
    ProxyCommand    ssh -W%h:%p FarEnd
    

    Combined with the fabulous sshuttle inception is at hand:

    sshuttle -r FarFarAway 0.0.0.0/0
    

all pages tagged ssh

ssh
Posted
Comments on this page are closed.