martes, 6 de junio de 2017

scripting your .ssh/config with scheme

Generating config files via programs is an old trick which I'm not going to rediscover now. But this one is my first scheme script I wrote for that purpose.

It's about generating a config file you ought to put in your ~/.ssh/config , so that there are some sane defaults when you are ssh-ing to your servers.



It's using the amazon cli interface to fetch the instances of your aws infrastructure. Then, concatenating it with a list of custome servers, and that's basically it (I'm using chicken scheme here, with the regex module which you can get via chicken-install):

With just this, you can already ssh to the servers and have your username filled in, or have your aliases in there.

Also, as I'm super super lazy, I also have a readily available command to prompt me for the server I want to ssh to, and make it ssh there. Quite simple stuff, but hey, it works :)

urxvt -e ssh $(grep 'host ' .ssh/config | awk '{print $2}' | dmenu -l 10)

No hay comentarios: