File size: 2,210 Bytes
292d92c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
---
description: Review which SSH connection names/hosts the user has configured
tags: [ssh, configuration, hosts, network, project, gitignored]
---
You are helping the user review their SSH connection configurations.
## Process
1. **Check if SSH config exists**
- Look for: `~/.ssh/config`
- If not found, offer to create one
2. **Parse SSH config file**
- Read `~/.ssh/config`
- Extract Host entries
- For each host, show:
- Host alias
- HostName (IP/domain)
- User
- Port
- IdentityFile (SSH key)
- Other options
3. **Display in organized format**
- Present as table or list:
```
Alias: server1
HostName: 192.168.1.100
User: admin
Port: 22
Key: ~/.ssh/id_rsa
---
```
4. **Check system-wide SSH config**
- Also check `/etc/ssh/ssh_config` for global settings
- Note any system-wide host configurations
5. **Test connectivity (optional)**
- Ask if user wants to test connections
- For each host:
```bash
ssh -T user@host
# or
ssh -o ConnectTimeout=5 user@host "echo Connection successful"
```
6. **Identify stale connections**
- Look for connections to:
- IPs that might have changed
- Servers that may no longer exist
- Old project servers
7. **Suggest config improvements**
- Recommend useful SSH config options:
```
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
TCPKeepAlive yes
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
```
8. **Offer to create new entries**
- If user wants to add new SSH hosts
- Template:
```
Host shortname
HostName hostname.com
User username
Port 22
IdentityFile ~/.ssh/id_ed25519
ForwardAgent yes
```
9. **Security check**
- Verify file permissions: `chmod 600 ~/.ssh/config`
- Look for insecure settings (password auth, etc.)
## Output
Provide a summary showing:
- List of configured SSH hosts
- Connection details for each
- Stale/inactive connections (if identified)
- Connectivity test results (if performed)
- Suggested improvements
- New entries added (if any)
|