[B b65.ch](/)

![](https://www.b65.ch/images/ssh-config-server-dialog-hero.jpg)

On this page

25.09.2024

# Create a handy SSH Dialog from your .ssh/config File

* * *

![](/images/ssh-dialog.png)

If you want to create a simple SSH Server Login Menu for your shell with all your configured Servers in your .ssh/config file, you can use this little script:

``#!/bin/bash DIALOG=${DIALOG=dialog} tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ trap "rm -f $tempfile" 0 1 2 5 15 ar=() for i in `cat ~/.ssh/config |grep -w Host| sed -e "s/Host //g" | grep -Ei '[a-z]'` do ar+=($i "") done $DIALOG --title "SSH Servers" --menu "Please choose a Server:" 30 45 10 "${ar[@]}" 2> $tempfile retval=$? choice=`cat $tempfile` case $retval in 0) clear echo "connecting $choice" echo "" ssh $choice server;; 1) clear;; 255) echo "Bye!";; esac``

This script will read your .ssh/config file and create a dialog menu with all the servers you have configured. If you select one of them, it will connect to that server via ssh.

The script uses the dialog utility which is part of most Linux distributions. You can install it on macOS using brew:

`brew install dialog`

or on Ubuntu/Debian:

`sudo apt install dialog`

© 2026 Simon Jenny [Blog (Englisch)](/blog/index.html) [Kontakt](/contact.html)

- [**{{title}}**  
  {{excerpt}}](%7B%7Burl%7D%7D)