Skip to content

Instantly share code, notes, and snippets.

@vkroz
Last active January 30, 2023 03:03
Show Gist options
  • Save vkroz/161a1576e7d8254ce63bc7f58c217b41 to your computer and use it in GitHub Desktop.
Save vkroz/161a1576e7d8254ce63bc7f58c217b41 to your computer and use it in GitHub Desktop.
SSH helpful stuff
Collection of tips and tricks for Linux

Login to remote box via tunnel

SSH from localhost to [email protected]

ssh -A -t cdc-srch-backup05.server.com "sudo su -l polaris -c 'ssh -t -l app ndc-searcher60.server.com'"

SSH from cdc-srch-backup05 to ndc-searcher60.walmart.com

ssh -A -t -l my_username cdc-srch-backup05.server.com ssh -A -t -l app ndc-searcher60.server.com

SSH from localhost to cdc-srch-backup05

ssh -A -t cdc-srch-backup05.server.com "sudo su -l my_username"

Port forwarding

Run on localhost

ssh -L 8080:10.54.0.2:443 kubebox.mydomain.com

Now https://127.0.0.1:8080 will go to kubebox.mydomain.com:443

lsof

lsof -i:8080
lsof -u user123

ip

ip a
ip route

nc

nc -vz myhost 8080

curl

curl -k -H 'Metadata-Flavor: Google' 'http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip'
curl --unix-socket /var/run/docker.sock http:/v1.24/containers/0fbdae18a512f6ac4acc6f9f736c16843af4669a0419b00488a2e55985715529/logs?stdout=1
curl --unix-socket /var/run/docker.sock -X POST http:/v1.24/containers/1c6594faf5/start
curl https://localhost:8080 -vIk
curl --insecure -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh -o script.rpm.sh
curl -sk https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
curl --insecure -L https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz  | tar xz -C /tmp/helm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment