The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

ssh prompt like Xmonad.Prompt.Ssh

asked 2014-04-01 20:02:04 +0000

yhager gravatar image

Is there a way to implement an ssh prompt, similar to Xmonad.Prompt.Ssh (sorry can't post a link)?

The way it works in Xmonad, is that when you press the key binding, you get a prompt, like dmenu, in which you type in a name of a host, and when you press <enter> you get a terminal with ssh to that host.

Very useful when working a lot with remote machines, saves the trouble of openning a shell and calling 'ssh <host>'

I guess one could come up with a script that parses .ssh/config, and calls dmenu on it, but I'm wondering if there's already something like that out there

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2014-04-01 22:17:11 +0000

joepd gravatar image

Wrap something like this with a keybind, that should do the trick:

urxvt -e ssh $(awk '{print $1}' ~/.ssh/known_hosts | dmenu -i -nb black -nf red -sb red -sf black -l 12)
edit flag offensive delete link more

Comments

perfect, thanks!

yhager gravatar imageyhager ( 2014-04-01 22:34:22 +0000 )edit
0

answered 2015-09-28 16:51:59 +0000

yhager gravatar image

I now mostly use .ssh/config, so the following is a better option now:

 bindsym $mod+c exec "urxvt -e ssh $(grep -i ^host ~/.ssh/config|grep -v '\*' |cut -d' ' -f 2-|sed 's/ /\n/g'|sort|uniq |grep -v '^$' | dmenu -i -nb black -nf red -sf black -sb red -l 12)"
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-01 20:02:04 +0000

Seen: 239 times

Last updated: Sep 28