sysadmin:ssh_conf
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sysadmin:ssh_conf [2025/11/21 16:24] – mlivolsi | sysadmin:ssh_conf [2025/11/21 16:31] (current) – mlivolsi | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| #!/bin/bash | #!/bin/bash | ||
| - | typeset -i looper=0 | + | looper=0 |
| - | typeset -A hostArray | + | hosts=() |
| - | while read comment hostName | + | # Read only the lines we care about |
| - | do | + | grep -E ' |
| - | | + | grep -Ev ' |
| - | if [ ${is_break} == "# | + | while read -r comment hostName |
| - | | + | |
| + | if [[ "${comment}" | ||
| + | echo " | ||
| else | else | ||
| - | | + | ((looper++)) |
| - | hostArray[$looper]=$hostName | + | hosts[$looper]="$hostName" |
| - | | + | echo " |
| fi | fi | ||
| - | done <<< | ||
| - | echo -e " | + | done |
| - | read answer | + | |
| - | ssh "${hostArray[$answer]}" | + | echo -n " |
| + | read -r answer | ||
| + | |||
| + | ssh "${hosts[$answer]}" | ||
| </ | </ | ||
| + | |||
| + | My ssh config | ||
| + | |||
| + | < | ||
| + | # | ||
| + | #_ Mike Network | ||
| + | # | ||
| + | Host n150-host | ||
| + | HostName x.x.x.x | ||
| + | User <your username> | ||
| + | ForwardAgent yes # forward agent to target | ||
| + | X11Forwarding yes # I need this for kvm gui | ||
| + | ForwardX11Trusted yes | ||
| + | </ | ||
| + | |||
| + | Obviously, you need to setup open-ssh on your servers and copy the required keys | ||
sysadmin/ssh_conf.1763742258.txt.gz · Last modified: by mlivolsi
