sysadmin:ssh_conf
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| sysadmin:ssh_conf [2025/11/21 16:21] – created mlivolsi | sysadmin:ssh_conf [2025/11/21 16:31] (current) – mlivolsi | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== SSH Access Script ==== | ==== SSH Access Script ==== | ||
| + | |||
| + | **Difficulty [1-10]: 1** | ||
| If you have an SSH config file, and don't want to remember all the entries (in my case, with home and work, my list is about 50 entries) | If you have an SSH config file, and don't want to remember all the entries (in my case, with home and work, my list is about 50 entries) | ||
| + | Location: / | ||
| + | |||
| + | < | ||
| + | |||
| + | #!/bin/bash | ||
| + | |||
| + | looper=0 | ||
| + | hosts=() | ||
| + | |||
| + | # Read only the lines we care about | ||
| + | grep -E ' | ||
| + | grep -Ev ' | ||
| + | while read -r comment hostName _; do | ||
| + | |||
| + | if [[ " | ||
| + | echo " | ||
| + | else | ||
| + | ((looper++)) | ||
| + | hosts[$looper]=" | ||
| + | echo " | ||
| + | fi | ||
| + | |||
| + | done | ||
| + | |||
| + | echo -n " | ||
| + | read -r answer | ||
| + | |||
| + | ssh " | ||
| + | </ | ||
| + | |||
| + | 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.1763742082.txt.gz · Last modified: by mlivolsi
