conemu multiple bash cygwin ssh

0

I just want to know how to have multiple tabs logged in to a server via ssh to for example ssh user1@1.1.1.1 for a tab named server1 (to some particular folder location) and ssh user2@2.2.2.2 for a tab named server2(to some particular folder location). Is there any way to do it automatically?

ybaylav

Posted 2014-12-15T09:06:13.010

Reputation: 15

I can just get connected manually by typing my credentials with an ssh commands. But what I want is to get connected automatically in 2 different tabs when start my computer. – ybaylav – 2014-12-15T10:48:31.723

Cygwin is not a real shell, it is a Windows application happens to run in console mode. Your multitabs are also a tweak to Windows, and not to Cygwin. Maybe if you go the other way around, and see if you can script Windows to wake multiple (single-tabbed) CygWin prompts and drop you into those places automatically? Just a guess, I never used Cygwin for long and I am not sure about any command-line switches. – arch-abit – 2014-12-15T10:49:10.707

Why not to use Tasks? – Maximus – 2014-12-15T10:49:14.113

Yes it must have done with tasks but how? As I'm using. C:\cygwin64\bin\bash.exe --login -i I think I'll be needing more parameters for auto ssh – ybaylav – 2014-12-15T10:52:04.273

Answers

2

This is how I setup a task for doing SSh with cygwin:

Simply add this to the command section for a task. Create a task for each connection and change the -new_console:t: bit

set CHERE_INVOKING=1 & %SystemDrive%\CygWin\bin\sh.exe -exec "ssh user@10.0.0.11" -new_console:t:Server

-new_console:t:Server == A new console tab with the name Server

An example of running a command after login:

-exec "ssh user@10.0.0.11 -t 'tmux attach' "

Nathan W

Posted 2014-12-15T09:06:13.010

Reputation: 216

And more of the same: http://stackoverflow.com/questions/12206190/cygwin-ssh-shortcut-from-windows-desktop

– arch-abit – 2014-12-15T11:06:43.080

@Nathan W is it possible that you examplify this? I did not get the -new_console:t:Server part. For example I use C:\cygwin64\bin\bash.exe --login -i in the commands section. Do I need to change this something like yours? – ybaylav – 2014-12-15T11:14:40.780

Just copy what I have as is, it works I used it every day. – Nathan W – 2014-12-15T11:31:21.363

@Nathan W It worked on me when I combined both of yours and mine like set CHERE_INVOKING=1 & C:\cygwin64\bin\bash.exe --login -i -new_console:t:TestServer -exec "ssh abc@xxx.xx.xx.xxx" But how about I want to go to a particular directory path after getting connected? What should I do then? Adding ;cd /a/b/c/d into the -exec quotes did not work. – ybaylav – 2014-12-15T11:38:18.677

@NathanW I tried -exec "ssh user@10.0.0.11 -t 'tmux attach' " but it did not work for me. I tried with these quotes `` instead of these '' it did not work in that way also. – ybaylav – 2014-12-15T11:50:31.787

I don't get it, why so complicated? Why run ssh via bash? Just created a new task ssh.exe user@example.com, it's working fine (Cygwin's ssh.exe is in the system PATH). – Gene Pavlovsky – 2016-10-02T17:14:17.267