I also wanted a way to invoke one command and get ssh connections to multiple pi's - in my case 25 of them (crazy, I know). I did it using "screen", a quirky but powerful "full screen window manager". This is probably not what you're looking for, but it might be an acceptable solution for someone who googles this topic and doesn't mind using screen.
Two ways of doing this - one with and one without a "regions" file - my terminology.
I have attached my screen configuration file (that defines what I want to ssh to), and which sources a "regions" file which splits a single terminal window into 24 regions, 4 across and 6 down, and which slots SSH sessions into particular regions. You go into a terminal and invoke it with "screen -c pi25A" and you'll get 25 sessions spread out across the screen in a grid. This works for me because I have a 32" 4K monitor and I can make the terminal window fullscreen AND set the font size very small and still read it. NOTE: I use ssh-agent so that I don't have to enter my password 25 times!
If you remove the sourcing of the regions file, you'll get all the SSH sessions stacked into one terminal window, on top of each other (best way I can describe it), each then taking up the whole of the original terminal.
In either case, there are hotkeys defined that let you move around in the many sessions.
Yes, I know 25 sessions don't fit into 24 regions - I've bought one pi too many and I haven't bothered to define a regions file with 5 regions across and 5 down.
edited for a typo and to add the note about ssh-agent...
Two ways of doing this - one with and one without a "regions" file - my terminology.
I have attached my screen configuration file (that defines what I want to ssh to), and which sources a "regions" file which splits a single terminal window into 24 regions, 4 across and 6 down, and which slots SSH sessions into particular regions. You go into a terminal and invoke it with "screen -c pi25A" and you'll get 25 sessions spread out across the screen in a grid. This works for me because I have a 32" 4K monitor and I can make the terminal window fullscreen AND set the font size very small and still read it. NOTE: I use ssh-agent so that I don't have to enter my password 25 times!
If you remove the sourcing of the regions file, you'll get all the SSH sessions stacked into one terminal window, on top of each other (best way I can describe it), each then taking up the whole of the original terminal.
In either case, there are hotkeys defined that let you move around in the many sessions.
Yes, I know 25 sessions don't fit into 24 regions - I've bought one pi too many and I haven't bothered to define a regions file with 5 regions across and 5 down.
Code:
% cat pi25A # create up to 25 sessions - 4 wide 6 down via regions24 plus one offscreenscreen -t "pi0 usb device" ssh -A pi@pi0.localscreen -t "pi02 red tree" ssh -A pi@pi02.localscreen -t "pi03 Heritage" ssh -A pi@pi03.localscreen -t "pi04 Serial Console" ssh -A pi@pi04.localscreen -t "piano HAT" ssh -A pi@piano.localscreen -t "pi0w reminder website" ssh -A pi@pi0w.localscreen -t "pi0w2 TBD" ssh -A pi@pi0w2.localscreen -t "pi0w3 320hd" ssh -A pi@pi0w3.localscreen -t "pi0w4 RGB tree" ssh -A pi@pi0w4.localscreen -t "pi0w5 pumpkin" ssh -A pi@pi0w5.localscreen -t "pi0w6 Laptrack! website" ssh -A pi@pi0w6.localscreen -t "pi0w7 - new simple tree" ssh -A pi@pi0w7.localscreen -t "pib dials website" ssh -A pi@pib.localscreen -t "pi2 500hd hdpds website" ssh -A pi@pi2.localscreen -t "pi22 - good new sense hat" ssh -A pi@pi22.localscreen -t "pi3a 128 sd - fan" ssh -A pi@pi3a.localscreen -t "piz Pi Zero 2 W - new 64-bit ethernet gadget" ssh -A pi@piz.localscreen -t "piz2 Pi Zero 2 W - new reminder" ssh -A pi@piz2.localscreen -t "piz3 Pi Zero 2 W - camera" ssh -A pi@piz3.localscreen -t "pi3 120 SSD" ssh -A pi@pi3.localscreen -t "pi32 - TBD" ssh -A pi@pi32.localscreen -t "pi42 - pi4 2GB for backups" ssh -A pi@pi42.localscreen -t "pi44 MultiBoot images" ssh -A pi@pi44.localscreen -t "pi48 - 240 SSD 64-bit bookworm desktop" ssh -A pi@pi48.localscreen -t "pi5 - bookworm 64-bit full" ssh -A pi@pi5.localsource regions24
Code:
% cat regions24 # create 24 regions, 4 across and 6 down# create 6 short wide regions down the screensplitsplitsplitsplitsplit# within each short wide region, split vertically into 4 narrower and smaller regionsfocus topsplit -vsplit -vsplit -vfocus downsplit -vsplit -vsplit -vfocus downsplit -vsplit -vsplit -vfocus downsplit -vsplit -vsplit -vfocus downsplit -vsplit -vsplit -vfocus downsplit -vsplit -vsplit -v# loop through regions, L to R, top to bottom, place sessions in them focus topselect 0focus rightselect 1focus rightselect 2focus rightselect 3focus topfocus downselect 4focus rightselect 5focus rightselect 6focus rightselect 7focus topfocus downfocus downselect 8focus rightselect 9focus rightselect 10focus rightselect 11focus topfocus downfocus downfocus downselect 12 focus rightselect 13focus rightselect 14focus rightselect 15focus topfocus downfocus downfocus downfocus downselect 16focus rightselect 17focus rightselect 18focus rightselect 19focus topfocus downfocus downfocus downfocus downfocus downselect 20focus rightselect 21focus rightselect 22focus rightselect 23# helpbind h focus leftbind j focus downbind k focus upbind l focus rightbind t focus topbind b focus bottom
Statistics: Posted by tinker2much — Sat Nov 09, 2024 3:07 am