This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| scripting:bash [2021/02/11 08:19] – jotasandoku | scripting:bash [2023/11/02 14:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| #run ssh agent | #run ssh agent | ||
| ssh-add ~/.ssh/* >/ | ssh-add ~/.ssh/* >/ | ||
| + | |||
| + | __EXAMPLE OF ssh/config FILE__:\\ | ||
| + | $ cat .ssh/ | ||
| + | Host * | ||
| + | AddKeysToAgent yes | ||
| + | # | ||
| + | ServerAliveCountMax 6 | ||
| + | ServerAliveInterval 10 | ||
| + | TCPKeepAlive yes | ||
| + | ForwardAgent yes | ||
| + | Compression yes | ||
| + | GatewayPorts yes | ||
| + | StrictHostKeyChecking no | ||
| + | User jaime.santos.amandi | ||
| + | | ||
| + | ## This is saying for anything for those IP ranges or for domains | ||
| + | ## use socks proxy over that host: bastion-lhr.myorgdatacloud.com | ||
| + | Host 10.32.* 10.33.* *.myorgdatacloud.com *.bigshot.co.uk !bastion-62-* | ||
| + | ProxyCommand ssh bastion-lhr.myorgdatacloud.com -W %h:%p | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | BASH CONDITIONS: | ||
| | | ||
| Line 114: | Line 140: | ||
| Apply to multiple hosts with no need for a script: | Apply to multiple hosts with no need for a script: | ||
| - | for i in admin-worker00.dc.grapeshot.co.uk \ | + | for i in admin-worker00.dc.mycompany1.co.uk \ |
| - | centosGUI.dc.grapeshot.co.uk \ | + | centosGUI.dc.mycompany1.co.uk \ |
| - | dbtest.dc.grapeshot.co.uk \ | + | dbtest.dc.mycompany1.co.uk \ |
| - | redis-admin.dc.grapeshot.co.uk \ | + | redis-admin.dc.mycompany1.co.uk \ |
| - | security-scanner01.dc.grapeshot.co.uk \ | + | security-scanner01.dc.mycompany1.co.uk \ |
| - | test.dc.grapeshot.co.uk \ | + | test.dc.mycompany1.co.uk \ |
| - | test01.dc.grapeshot.co.uk ; \ | + | test01.dc.mycompany1.co.uk ; \ |
| do ssh root@" | do ssh root@" | ||
| | | ||
| Line 156: | Line 182: | ||
| echo -e " | echo -e " | ||
| Host $val1 | Host $val1 | ||
| - | | + | |
| User jaime_santos | User jaime_santos | ||
| Port 22"; | Port 22"; | ||
| Line 354: | Line 380: | ||
| **TO EVALUATE COMMANDS REMOTELY (SSH)** | **TO EVALUATE COMMANDS REMOTELY (SSH)** | ||
| - | ssh root@jaguar27.dc.grapeshot.co.uk "/ | + | ssh root@jaguar27.dc.mycompany1.co.uk "/ |
| | | ||